aboutsummaryrefslogtreecommitdiff
path: root/riot
diff options
context:
space:
mode:
authorRoman Gräf <romangraef@gmail.com>2020-04-18 15:33:01 +0200
committerRoman Gräf <romangraef@gmail.com>2020-04-18 15:33:01 +0200
commit6a6fd1828959e3343e58e3ddc36790b4a25e1747 (patch)
treeb155ea05bf32aef00adca52f77a46deae248939e /riot
parent6c66e81946d005dac3b05be73889da28936b0ad0 (diff)
downloadLDJam46-6a6fd1828959e3343e58e3ddc36790b4a25e1747.tar.gz
LDJam46-6a6fd1828959e3343e58e3ddc36790b4a25e1747.tar.bz2
LDJam46-6a6fd1828959e3343e58e3ddc36790b4a25e1747.zip
Anfänge von Riots und Eingebundene Dev hire assets
Diffstat (limited to 'riot')
-rw-r--r--riot/angrydev.gd23
-rw-r--r--riot/angrydev.tscn26
-rw-r--r--riot/riot.gd17
-rw-r--r--riot/riot.tscn11
4 files changed, 77 insertions, 0 deletions
diff --git a/riot/angrydev.gd b/riot/angrydev.gd
new file mode 100644
index 0000000..078d6e8
--- /dev/null
+++ b/riot/angrydev.gd
@@ -0,0 +1,23 @@
+extends Node2D
+class_name AngryDev
+
+var min_pitchfork_rotation : float = -15.0
+var max_pitchfork_rotation : float = 50.0
+export var rotation_speed : float = 1
+var total_tick = 0.0
+onready var pitchfork : Sprite = $pitchfork
+
+
+func interpolate(a, b, progress):
+ return a + (b-a) * progress
+
+func _process(delta : float) -> void:
+ total_tick += delta
+ var normalized_progress = (sin(total_tick * rotation_speed) + 1.0) / 2.0
+ var rot = interpolate(min_pitchfork_rotation, max_pitchfork_rotation, normalized_progress)
+ pitchfork.rotation_degrees = rot
+
+
+func rotate_towards(player: Node2D) -> void:
+ if player.position.x < position.x:
+ scale.x = -abs(scale.x)
diff --git a/riot/angrydev.tscn b/riot/angrydev.tscn
new file mode 100644
index 0000000..d3c2370
--- /dev/null
+++ b/riot/angrydev.tscn
@@ -0,0 +1,26 @@
+[gd_scene load_steps=5 format=2]
+
+[ext_resource path="res://assets/angry_dev.png" type="Texture" id=1]
+[ext_resource path="res://assets/pitchfork.png" type="Texture" id=2]
+[ext_resource path="res://riot/angrydev.gd" type="Script" id=3]
+
+[sub_resource type="RectangleShape2D" id=1]
+extents = Vector2( 7.90784, 32.0742 )
+
+[node name="Node2D" type="Node2D"]
+position = Vector2( -24.1174, 33.1615 )
+script = ExtResource( 3 )
+
+[node name="body" type="Sprite" parent="."]
+position = Vector2( 25, -32 )
+texture = ExtResource( 1 )
+
+[node name="pitchfork" type="Sprite" parent="."]
+position = Vector2( 59.0399, -57.764 )
+scale = Vector2( 1, 3 )
+texture = ExtResource( 2 )
+offset = Vector2( 0.330124, -33.3885 )
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="pitchfork"]
+position = Vector2( 0.128513, -33.3091 )
+shape = SubResource( 1 )
diff --git a/riot/riot.gd b/riot/riot.gd
new file mode 100644
index 0000000..da5e0fc
--- /dev/null
+++ b/riot/riot.gd
@@ -0,0 +1,17 @@
+extends Node2D
+
+var dev = preload("res://riot/angrydev.tscn")
+
+func random_position():
+ return Vector2(rand_range(30, 1000), rand_range(30, 600))
+
+var devs = []
+func _ready() -> void:
+ for i in range(10):
+ var instance: AngryDev = dev.instance()
+ instance.position = random_position()
+ add_child(instance)
+ devs.append(instance)
+func _input(event) -> void:
+ if event is InputEventMouseMotion:
+ print(event.position)
diff --git a/riot/riot.tscn b/riot/riot.tscn
new file mode 100644
index 0000000..291a368
--- /dev/null
+++ b/riot/riot.tscn
@@ -0,0 +1,11 @@
+[gd_scene load_steps=3 format=2]
+
+[ext_resource path="res://riot/riot.gd" type="Script" id=1]
+[ext_resource path="res://assets/manager.png" type="Texture" id=2]
+
+[node name="Node2D" type="Node2D"]
+script = ExtResource( 1 )
+
+[node name="manager" type="Sprite" parent="."]
+position = Vector2( 600.978, 319.858 )
+texture = ExtResource( 2 )