#Make dash direction match player direction

3 messages · Page 1 of 1 (latest)

wet warren
#

My dash button works, but the player only dashes in their initial "x" direction no matter which way they are facing when dash is pressed.

#Handle dash if Input.is_action_just_pressed("dash"): velocity.x = DASH_VELOCITY

How can I get player's facing direction and make the dash function send them that same way?

#

I should mention I have a variable "player_facing_direction" which should have what I need (?), i'm just not sure how to implement its value to the dash

# Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. var input_dir = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down") player_facing_direction = input_dir $".".rotation.y += -player_facing_direction.x * face_direction_velocity

wet warren
#

This seems to work how I want it to:
#Handle dash if Input.is_action_just_pressed("dash"): position += transform.basis * Vector3(0,0, -SPEED)