So when I turn to the left, the objects image is upside down. And that really bothers me. Especially when nyan cat is there. Can someone find a way so when the image is to the left, the image flips vertically (I know how to flip an image vertically but I don't know how to set up the code for it)
Thanks in advance!
-tReks
Code For Lobster Class:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Lobster extends Animal
{
private int timer = 200;
private int pic = 1;
int nyan = 0;
int dir = 0
;
public void act()
{
move();
if ( Greenfoot.isKeyDown("up") )
{
move(20);
}
if ( Greenfoot.isKeyDown("down") )
{
move(-25);
}
if ( Greenfoot.isKeyDown("right") )
{
turn(10);
}
if ( Greenfoot.isKeyDown("left") )
{
turn(-10);
}
if (canSee(Crab.class))
{
eat(Crab.class);
Greenfoot.playSound("au.wav");
}
if ( atWorldEdge() )
{
setRotation( getRotation() - 180 );
Worm willy = new Worm();
getWorld().addObject(willy,0,0);
}
if ( Greenfoot.isKeyDown("space") && nyan == 1 )
{
Rb rb = new Rb();
getWorld().addObject(rb,getX(),getY());
rb.setRotation(getRotation());
}
else
{
if ( Greenfoot.isKeyDown("space"))
{
Worm wilma = new Worm();
getWorld().addObject(wilma,getX(),getY());
wilma.setRotation(getRotation());
}
}
if ( timer > 0 )
{
timer -=1;
}
else
{
if ( pic == 1 )
{
setImage("lobster.png");
pic +=1;
nyan = 0;
timer=100;
}
else if (( pic == 2 ))
{
setImage("frog.png");
pic +=1;
nyan = 0;
timer=100;
}
else if (( pic == 3 ))
{
setImage("frog.png");
pic = 4;
nyan = 0;
timer=100;
}
else
{
setImage("nyan.png");
nyan = 1;
pic = 1;
timer=300;
}
}
}
}

