only connect hit timer to hitting state once
This commit is contained in:
parent
5ef7959f19
commit
115bcf8817
2 changed files with 3 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ func _ready() -> void:
|
||||||
assert(id == 1 or id == 2, "id ("+str(id)+") is invalid")
|
assert(id == 1 or id == 2, "id ("+str(id)+") is invalid")
|
||||||
anim_dir = 'up' if id == 1 else 'down'
|
anim_dir = 'up' if id == 1 else 'down'
|
||||||
def_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:
|
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')
|
var x_mov: float = Input.get_action_strength('p'+str(id)+'_move_right') - Input.get_action_strength('p'+str(id)+'_move_left')
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ func _enter(_previous_state_path: String, _data: Dictionary = {}) -> void:
|
||||||
|
|
||||||
hit_node_ref = weakref(hit_node)
|
hit_node_ref = weakref(hit_node)
|
||||||
|
|
||||||
player.hit_timer.timeout.connect(_on_hit_end)
|
# cooldown
|
||||||
player.hit_timer.start()
|
player.hit_timer.start()
|
||||||
|
|
||||||
func _on_hit_end() -> void:
|
func _on_hit_end() -> void:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue