From b507c624251ab216c7b9a1c4aa0c27b23287f37f Mon Sep 17 00:00:00 2001 From: Luna Brovchuk Date: Sun, 1 Oct 2023 17:28:57 +0200 Subject: [PATCH] Add Delay After Ghost's Dash --- src/models/enemies/ghost/Ghost.tscn | 1 - src/models/enemies/ghost/ghost.gd | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/models/enemies/ghost/Ghost.tscn b/src/models/enemies/ghost/Ghost.tscn index 3dd4272..a763fe5 100644 --- a/src/models/enemies/ghost/Ghost.tscn +++ b/src/models/enemies/ghost/Ghost.tscn @@ -25,7 +25,6 @@ flip_h = true use_parent_material = true frames = ExtResource( 1 ) animation = "idle" -frame = 2 playing = true centered = false diff --git a/src/models/enemies/ghost/ghost.gd b/src/models/enemies/ghost/ghost.gd index c6504a0..f2f124e 100644 --- a/src/models/enemies/ghost/ghost.gd +++ b/src/models/enemies/ghost/ghost.gd @@ -2,6 +2,8 @@ extends EnemyClass onready var player = $"../../Player" var dash_target = Vector2.ZERO +var afterdash_timer = .0 +var afterdash = false var dash_timer = .0 var dashing = false @@ -33,4 +35,11 @@ func _physics_process(delta): global_position = global_position.move_toward(dash_target, 10) if global_position == dash_target: dashing = false + afterdash = true + + if afterdash: + afterdash_timer += delta + if afterdash_timer >= 1: + afterdash = false + afterdash_timer = .0 dash_target = Vector2.ZERO