0 votes

2d top-down game. player controller - movetomouse
e.g. we've got a var speed
and player moves toward some direction
I want him to "warp" almost instantly for a 100-150 px but not to animate it, I want to see how it's speed increases for a bit, and then decreases right at the end of a warp.
visual effects I will add by myselft I just need help to understand how to "boost" him.

Godot version v3.4.2.stable.official
in Engine by (60 points)

3 Answers

0 votes
by (42 points)
0 votes

speed = 100

event press button
speed = 500
yield(gettree().createtimer(0.25), "timeout")

speed = 100

smt like that

by (60 points)
+1 vote

You can simply do:

var speed = 100

func _process(delta):
    if Input.is_action_just_pressed("increase_speed"):
        speed += 100

I am assuming that you set the speed to 100. You can change it by just changing the value of the variable speed.

by (81 points)
edited by
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.
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 webmaster@godotengine.org with your username.