- Edited
I want to make a Megaman-like dash mechanic for my 2D platformer game, but right now, it's more like blinking instead of dashing. Basically, the player character will appear at the destination without traversing.
I made two scripts, but both scripts act like blinking.
func dash() -> void:
var dash_velocity: Vector2
if is_facing_right:
dash_velocity = Vector2.RIGHT * dash_speed
else:
dash_velocity = Vector2.LEFT * dash_speed
velocity.y = move_and_slide(dash_velocity, FLOOR_UP).y
can_dash = false
dash_cooldown.start()
func dash() -> void:
var dash_velocity: Vector2
if is_facing_right:
dash_velocity = Vector2.RIGHT * (dash_distance / dash_time)
else:
dash_velocity = Vector2.LEFT * (dash_distance / dash_time)
velocity.y = move_and_slide(dash_velocity, FLOOR_UP).y
can_dash = false
dash_cooldown.start()