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

2019/11/3

Greenfoot - Movement BUG?

ITStudent ITStudent

2019/11/3

#
Hello Guys, i have a problem again. I want to make a boost-movement, so if q is pressed the movement will be double so fast like before. I have the script what works perfect. But if I press Q (Boost), W and A (So diagonal ) the boost works fine, WD and SA too, but if i press SD, the boost doesnt work. I dont find any error. I hope you can understand, what i mean. Script for boost: if(d<100){d++;} getWorld().showText("Boost:"+d,30,100); if(d>0){ if(Greenfoot.isKeyDown("Q")){d = d-2;if (Greenfoot.isKeyDown("W")){ y= y - 2; this.setLocation(x,y);} if (Greenfoot.isKeyDown("S")){y=y+2; this.setLocation(x,y);} if (Greenfoot.isKeyDown("A")){x=x-2; this.setLocation(x,y);} if (Greenfoot.isKeyDown("D")){x=x+2; ;this.setLocation(x,y);}}} Thank You very much!
danpost danpost

2019/11/3

#
That just might be a hardware issue (keyboard constraint). Try using "shift" instead of "q".
ITStudent ITStudent

2019/11/3

#
So i am using shift instead of q and now everything is working fine. Thank You.
You need to login to post a reply.