Hey guys, I'm creating a game with 3 characters. 2 characters need to be slow and 1 needs to be fast. I'm almost done but I have a problem with making the third character run fast since I don't use the move() method to move the player.
This is how I move:
Is there a way to increase his movement speed? But not by doing something like: setLocation(getX()+2,getY()); because I don't want the actor to skip blocks.
if(Greenfoot.isKeyDown("right")){
setRotation(90);
//Controleer of er rechts van de speler geen water is, als dit niet zo is loop naar rechts.
if(dijkrechts != null || (genieY >=38 && genieX != 49)){
setLocation(getX()+1, getY());
setGenieImage();
}
}
else if(Greenfoot.isKeyDown("up")){
setRotation(0);
//Controleer of er boven de speler geen water is, als dit niet zo is loop naar boven.
if(dijkboven != null || genieY >=38){
setLocation(getX(), getY()-1);
setGenieImage();
}
}
else if(Greenfoot.isKeyDown("left")){
setRotation(270);
//Controleer of er links van de speler geen water is, als dit niet zo is loop naar links.
if(dijklinks != null || (genieY >= 38 && genieX != 0)){
setLocation(getX()-1, getY());
setGenieImage();
}
}
else if(Greenfoot.isKeyDown("down")){
setRotation(180);
//Controleer of er onder de speler geen water is, als dit niet zo is loop naar beneden.
if(dijkonder != null || (genieY >= 38 && genieY < 47)){
setLocation(getX(), getY()+1);
setGenieImage();
}
}
