diff options
author | Victor Andrade de Almeida <vct.a.almeida@gmail.com> | 2022-07-16 18:03:04 -0300 |
---|---|---|
committer | Victor Andrade de Almeida <vct.a.almeida@gmail.com> | 2022-07-16 18:31:27 -0300 |
commit | 3b28b4585b5272a4c72a2c89f02f4441945e03fd (patch) | |
tree | d2ee3cf215888f980e169f3f80463928ffce12a2 | |
parent | 7111fadc087193909e985937519e313b670658e8 (diff) | |
download | gamejam-gmtk-2022-3b28b4585b5272a4c72a2c89f02f4441945e03fd.tar.gz gamejam-gmtk-2022-3b28b4585b5272a4c72a2c89f02f4441945e03fd.tar.bz2 gamejam-gmtk-2022-3b28b4585b5272a4c72a2c89f02f4441945e03fd.zip |
Call step after bounce
-rw-r--r-- | Scenes/Dungeon.gd | 7 | ||||
-rw-r--r-- | Scenes/PlateBounce.gd | 8 | ||||
-rw-r--r-- | Scenes/PlateBounce.tscn | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/Scenes/Dungeon.gd b/Scenes/Dungeon.gd index c1ece2f..40dc566 100644 --- a/Scenes/Dungeon.gd +++ b/Scenes/Dungeon.gd @@ -148,10 +148,6 @@ func process_turn_logic(): # player move move_entity(player, input) - - var player_tile = entities_tiles[player] - if tiles_floor.has(player_tile): - tiles_floor[player_tile].step(player, self) input = Vector2.ZERO # check tile player @@ -214,6 +210,9 @@ func move_entity(entity : Entity, dir : Vector2): entity.add_action("cor_move", [tile_to_pos(new_tile), 0.2]) entity.roll(dir) + if tiles_floor.has(new_tile): + tiles_floor[new_tile].step(entity, self) + func tile_to_pos(tile : Vector2): return Vector3(tile.x, 0, -tile.y) diff --git a/Scenes/PlateBounce.gd b/Scenes/PlateBounce.gd index b3b0ec4..e2e9415 100644 --- a/Scenes/PlateBounce.gd +++ b/Scenes/PlateBounce.gd @@ -5,11 +5,18 @@ export(int) var cardinal setget set_cardinal onready var mesh : MeshInstance = $Mesh onready var is_ready : bool = true +var is_active : bool + func _ready(): set_cardinal(cardinal) func activate(entity : Entity, dungeon): + if is_active: + return + var direction : Vector2 + is_active = true + match cardinal: 0: direction = Vector2(0, +1) 1: direction = Vector2(-1, 0) @@ -17,6 +24,7 @@ func activate(entity : Entity, dungeon): 3: direction = Vector2(+1, 0) dungeon.move_entity(entity, direction) + is_active = false func set_cardinal(value : int): if is_ready: diff --git a/Scenes/PlateBounce.tscn b/Scenes/PlateBounce.tscn index d5b2d07..da7395b 100644 --- a/Scenes/PlateBounce.tscn +++ b/Scenes/PlateBounce.tscn @@ -12,7 +12,7 @@ albedo_texture = ExtResource( 2 ) [node name="PlateBounce" type="Spatial"] script = ExtResource( 1 ) -valid_symbols = [ "2", "3", "4", "5", "6" ] +valid_symbols = [ "2", "3", "4", "5", "6", "" ] cardinal = null [node name="Mesh" type="MeshInstance" parent="."] |