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 :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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 } } } |