Hello,
two months ago i asked how i play gifs only once(or for a certain time)
Link to the first question
i tried the code i got from danpost:
But in line 11 i get an error saying that the class "List" wasn't found.
how do i fix that issue? i think im doing something wrong. thx :)
import greenfoot.*;
public class explosion extends Actor
{
GifImage explosion = new GifImage("explosion.gif");
GreenfootImage imageOne;
boolean notImageOne;
public explosion()
{
List<GreenfootImage> images = explosion.getImages(); // get list of images
imageOne = images.get(0); // get reference to first image
for (GreenfootImage img : images) img.scale(75, 75); // scale all images
setImage(explosion.getCurrentImage()); // set initial image
}
public void act()
{
setImage(explosion.getCurrentImage()); // animate
if ((getImage() != imageOne) != notImageOne) // was there a change involving first image
{
notImageOne = ! notImageOne; // record change
if (! notImageOne) getWorld().removeObject(this); // if setting first image, remove explosion from world
}
}
}