I'm having trouble with the bouncing of my actor off the wall because the image reverses. How do I not make it flip?
public void act()
{
move(3);
checkWalls();
if(Greenfoot.isKeyDown("space"))
{
move(-3);
}
}
public void checkWalls()
{
boolean atXEdge = getX() < 10 || getX() > getWorld().getWidth()-10;
boolean atYEdge = getY() < 10 || getY() > getWorld().getHeight()-10;
if (atXEdge || atYEdge)
{
move(-3);
}
if (atXEdge)
{
setRotation(540-getRotation());
}
if (atYEdge)
{
setRotation(360-getRotation());
}
}
