How do I make an actor with an animated gif image? I have a separate GifImage class but I'm not sure how to use it.


1 | GifImage gifImage = new GifImage( "mygif.gif" ); |
1 | setImage(gifImage.getCurrentImage()); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public class Monkey extends Actor { private String img; private GifImage gif; public Monkey( String img ) { this .img = img; gif = new GifImage( img ); } public void act() { setImage( gif.getCurrentImage() ); } } |
1 2 3 4 5 6 7 8 9 10 11 12 | public class GifImage { private String img; public GifImage( String img ) { this .img = img; } public GreenfootImage getCurrentImage() { return new GreenfootImage( img ); } } |