This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

So i have an AnimatedSprite and i want it to dash to where it is currently looking on the x axis, and i want it to only dash with a certain speed/certain amount of time and then stop immediately. Is that possible?

in Engine by (18 points)

1 Answer

0 votes

While this surely isn't the best way to do this, a simple solution would be to change your velocity before your move and slide function like this:

if Input.is_action_just_pressed("dash"):
  var mouse_direction = get_local_mouse_position().normalized()
  velocity = Vector2(DASH_SPEED * mouse_direction.x, DASH_SPEED * mouse_direction.y)

you can fiddle around with dash speed so the player dashes within your designated time range and speed.

by (207 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.