This site requires JavaScript, please enable it in your browser!
Greenfoot back
ambrokato
ambrokato wrote ...

2021/4/29

how to teleport to a location as a character movement?

ambrokato ambrokato

2021/4/29

#
Hello, I want to make this top-down shooter game. Instead of having the character roll while dodging incoming bullets. I want it to do a mini dash teleport instead. but I can't figure out the code for it. The idea is when the player press the spacebar the character will perform that action. please help and thank you.
danpost danpost

2021/4/29

#
Essential code:
int speed = 1; // normal speed
if (Greenfoot.isKeyDown("space")) speed = 4: // dash speed
move(speed);
A direction key must also be pressed. The dashing can be limited either by distance traveled or by time between use, or both.
You need to login to post a reply.