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?

asked Jun 21 in Engine by jmmarzon12 (17 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.

answered Jun 22 by DigitalDrako (108 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 How to use this Q&A? before posting your first questions.