I have an object set to change its image several times, but it keeps resetting to the starting image when it is image10. how can I get it to stay at image 10 when it is image 10? Here is the code
public void switchImage() { setImage(image1); if ( getImage() == image1) { setImage(image2); Greenfoot.delay(10); } if ( getImage() == image2) { setImage(image3); Greenfoot.delay(10); } if ( getImage() == image3) { setImage(image4); Greenfoot.delay(10); } if ( getImage() == image4) { setImage(image5); Greenfoot.delay(10); } if ( getImage() == image5) { setImage(image6); Greenfoot.delay(10); } if ( getImage() == image6) { setImage(image7); Greenfoot.delay(10); } if ( getImage() == image7) { setImage(image8); Greenfoot.delay(10); } if ( getImage() == image8) { setImage(image9); Greenfoot.delay(10); } if ( getImage() == image9) { setImage(image10); } }