summaryrefslogtreecommitdiff
path: root/Scenes/PlateBounce.gd
diff options
context:
space:
mode:
authorVictor Andrade de Almeida <vct.a.almeida@gmail.com>2022-07-16 16:11:43 -0300
committerVictor Andrade de Almeida <vct.a.almeida@gmail.com>2022-07-16 16:11:53 -0300
commit123c6f3db50f5fbb2160d65f2d36f8c6238125ee (patch)
tree1207ef2994bf9c9510cc6b3a92c259d670dd57f8 /Scenes/PlateBounce.gd
parentfb6c3986e8b7c636d14703b028da7095c272a6b4 (diff)
downloadgamejam-gmtk-2022-123c6f3db50f5fbb2160d65f2d36f8c6238125ee.tar.gz
gamejam-gmtk-2022-123c6f3db50f5fbb2160d65f2d36f8c6238125ee.tar.bz2
gamejam-gmtk-2022-123c6f3db50f5fbb2160d65f2d36f8c6238125ee.zip
Add bounce pressure plates
Diffstat (limited to 'Scenes/PlateBounce.gd')
-rw-r--r--Scenes/PlateBounce.gd24
1 files changed, 24 insertions, 0 deletions
diff --git a/Scenes/PlateBounce.gd b/Scenes/PlateBounce.gd
new file mode 100644
index 0000000..b3b0ec4
--- /dev/null
+++ b/Scenes/PlateBounce.gd
@@ -0,0 +1,24 @@
+extends Plate
+
+export(int) var cardinal setget set_cardinal
+
+onready var mesh : MeshInstance = $Mesh
+onready var is_ready : bool = true
+
+func _ready():
+ set_cardinal(cardinal)
+
+func activate(entity : Entity, dungeon):
+ var direction : Vector2
+ match cardinal:
+ 0: direction = Vector2(0, +1)
+ 1: direction = Vector2(-1, 0)
+ 2: direction = Vector2(0, -1)
+ 3: direction = Vector2(+1, 0)
+
+ dungeon.move_entity(entity, direction)
+
+func set_cardinal(value : int):
+ if is_ready:
+ mesh.transform.basis = Basis(Vector3.UP, value * PI / 2)
+ cardinal = value