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

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 (63 points)

3 Answers

0 votes
by (46 points)
0 votes

speed = 100

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

speed = 100

smt like that

by (63 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 (93 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 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.