JuegoClase/Player/Dash.gd

25 lines
568 B
GDScript3
Raw Normal View History

2024-10-26 05:47:55 +00:00
extends PlayerState
var dashSpeed = 400
var direccionDash = 1
func state_enter_state(msg := {}):
player.canDash = false
player.velocity.y = Input.get_axis("ui_up","ui_down") * dashSpeed
player.velocity.x = Input.get_axis("ui_left","ui_right") * dashSpeed
# if $"../../Sprite2D".flip_h:
# direccionDash = -1
# else:
# direccionDash = 1
$DashTimer.start()
func state_physics_process(delta):
#
# player.velocity.x = direccionDash * dashSpeed
# print(player.velocity)
player.move_and_slide()
func _on_dash_timer_timeout():
state_machine.transition_to("Idle")