Thought this looked right but keeps giving me the error, " must be caught or declared to be thrown". This is the code for the whole class. The wait is under the moveImage method. Any help I am grateful for, thanks.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class CavernTank here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class TankBoss extends SmoothMovement
{
private GreenfootImage image1;
private GreenfootImage image2;
private GreenfootImage image3;
int imgFrame = 0; //This keeps track of which image frame it is currently showing
public TankBoss()
{
image1 = new GreenfootImage("CavernTank_0.png");
image2 = new GreenfootImage("CavernTank_1.png");
image3 = new GreenfootImage("CavernTank_2.png");
}
public void act()
{
moveImage();
}
public void moveImage() //This would be a loop going constantly to animate it
{
imgFrame++;
if (imgFrame == 4)
{
imgFrame = 1;
}
if (imgFrame == 1)
{
setImage(image2);
wait(5);
}
if (imgFrame == 2)
{
setImage(image3);
}
if (imgFrame == 3)
{
setImage(image1);
}
}
}
