This site requires JavaScript, please enable it in your browser!
Greenfoot back
DrCrane
DrCrane wrote ...

2018/1/26

Using an animated GIF as image

DrCrane DrCrane

2018/1/26

#
I've been searching the forums around but none of the topics already created, and their solutions work for me. What I'm looking for is quite simple. I need an actor with just an animated GIF as image. I am not planning to put in any code for the game. (Of course if its needed for the animated GIF itself that's no problem). Right now I have a blank class and the GifImage class important. Any help is appreciated
danpost danpost

2018/1/26

#
Basically, you create and keep a reference to the GifImage object in the class of the object that uses that gif. Then the act method should continuously get the current image (based on time) and set it to the object. The GifImage class makes extensive use of the 'java.awt' package. As such, they will only work on the site in a java applet (the Legacy version) -- they will not currently work in HTML 5 (javascript version). If you require any more details on the use of the class, show what you have tried and explain the issue.
DrCrane DrCrane

2018/1/26

#
danpost wrote...
Basically, you create and keep a reference to the GifImage object in the class of the object that uses that gif. Then the act method should continuously get the current image (based on time) and set it to the object. The GifImage class makes extensive use of the 'java.awt' package. As such, they will only work on the site in a java applet (the Legacy version) -- they will not currently work in HTML 5 (javascript version). If you require any more details on the use of the class, show what you have tried and explain the issue.
Ah, the setImage should be in the act! I put it in the constructor. Thanks a lot :)
You need to login to post a reply.