only connect hit timer to hitting state once

This commit is contained in:
yuki 2025-11-14 23:31:58 -03:00
parent 5ef7959f19
commit 115bcf8817
2 changed files with 3 additions and 2 deletions

View file

@ -16,6 +16,7 @@ func _ready() -> void:
assert(id == 1 or id == 2, "id ("+str(id)+") is invalid")
anim_dir = 'up' if id == 1 else 'down'
def_dir = 'up' if id == 1 else 'down'
hit_timer.connect("timeout", $StateMachine/Hitting._on_hit_end)
func get_movement_vector() -> Vector2:
var x_mov: float = Input.get_action_strength('p'+str(id)+'_move_right') - Input.get_action_strength('p'+str(id)+'_move_left')

View file

@ -42,8 +42,8 @@ func _enter(_previous_state_path: String, _data: Dictionary = {}) -> void:
)
hit_node_ref = weakref(hit_node)
player.hit_timer.timeout.connect(_on_hit_end)
# cooldown
player.hit_timer.start()
func _on_hit_end() -> void: