Hello citizens of the world,
I have a problem with my game. I want to add a enemy who move's random on the X-axis. So some pixels left and than some pixels to the right.
So I made this and he is random moving. But in the corners he is "leaving" the map and het is shaking cause he is changing the way he move's to fast.
This is the code:
How can I fix this?
Thanks for helping :)
public void Move() {
if(Greenfoot.getRandomNumber(500) <250) {
move(-2);
}
if(Greenfoot.getRandomNumber(500) >=250) {
move(2);
}
}

