Hey guys, i created the movement code for my actor class "Mädchen". The problem is that it is always looking at the right edge of my world. Regardless of whether it runs to the right or to the left. How can I program it to look to the left when it runs to the left?
public class Mädchen extends Actor
{
private GreenfootImage image1;
private GreenfootImage image2;
private GreenfootImage image3;
private int imgTimer = 0;
public Mädchen()
{
image1=new GreenfootImage("silhouette1.png");
image2=new GreenfootImage("silhouette2.png");
image3=new GreenfootImage("silhouette3.png");
setImage(image1);
}
public void act()
{
move();
switchImage();
removeTouching(Apple.class);
removeTouching(Banana.class);
removeTouching(Lemon.class);
}
public void move()
{
if (Greenfoot.isKeyDown("right"))
{
move(3);
}
if (Greenfoot.isKeyDown("left"))
{
move(-3);
}
}
public void switchImage()
{
if (++imgTimer%10 != 0) return;
if (getImage() == image1)
{
setImage(image2);
}
else
{
if (getImage() == image2)
{
setImage(image3);
}
else
{
setImage(image1);
}
}
}
}




