So i saw several posts about gifs and how to use them. However, whenever i attempt to replicate them my gif just wont work. My gif is a blinking cursor for typing. When im dragging it onto the world it is blinking, but as soon as i let go/or press play it just stays as a solid black line. Here's my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | public class Cursor extends Actor { GifImage gif = new GifImage( "Cursor.gif" ); public Cursor() { int scalePercent = 25 ; for (GreenfootImage image : gif.getImages()) { int wide = image.getWidth()*scalePercent/ 100 ; int high = image.getHeight()*scalePercent/ 100 ; image.scale(wide, high); } } /** * Act - do whatever the Cursor wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setImage(gif.getCurrentImage()); } } |