Good evening fellow greenfooters.
I would really appreciate assistance with my issue, I need my subclass of Actor(my Character that the player controls) to gain a boost of speed for 2 seconds every 3 seconds. I haven't been able to figure this out and I'm pulling my hair out XD! Also when the Character gets this 2 second speed boost I want him to become invulnerable and be able to eat the enemy "creeps" its kinda like how PACMAN works when the world goes blue.
Here is my movement code because I'm sure it has something to do with that.
Best regards
Katsura
public void checkKeyPress()
{
if(Greenfoot.isKeyDown("left"))
{
int X= getX();
int Y= getY();
setLocation(X-4,Y);
}
if(Greenfoot.isKeyDown("right"))
{
int X= getX();
int Y= getY();
setLocation(X+4,Y);
}
if(Greenfoot.isKeyDown("up"))
{
int X= getX();
int Y= getY();
setLocation(X,Y-4);
}
if(Greenfoot.isKeyDown("down"))
{
int X= getX();
int Y= getY();
setLocation(X,Y+4);
}
}

