I need help with a school project
I want to change the image to at turning ship when I press right
here is my code
import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot)
/**
* A simple SpaceShip that can move up and down.
*
* @author Poul Henriksen
*/
public class SpaceShip extends Actor
{
private GreenfootImage spaceship = new GreenfootImage("Spaceship.png");
private GreenfootImage spaceshipRight = new GreenfootImage("spaceship right.png");
public void checkKeys()
{
if (Greenfoot.isKeyDown("right") )
{
setLocation (getX() + 2, getY());
}
if (Greenfoot.isKeyDown("left") )
{
setLocation (getX() - 2, getY());
}
}
public void turn( boolean turn )
{
if (Greenfoot.isKeyDown("right"))
{
setImage (spaceshipRight);
}
if (!Greenfoot.isKeyDown("right"))
{
setImage (spaceship);
}
}
}


