text: I am creating a game in which I want to have an animated character. I have all the animations in GIF format (walking left, walking right, idle, shooting with the slingshot, and transitions between walking and idle and vice versa) The first problem is that the GIF I use 1. half of the time "softlocks" the project for some reason (as soon as I try to load the level where my character is in it just freezes, when I hit reset it will just grey out and not do anything) 2. doesn't play the 1/1000 times it does actually load. I used the GifImage class that is featured within Greenfoot, and the method resume should (in theory) start the animation, right? So why does it not play? Here is my character class:
  And the second question, how to I implement the animations smart? I want to have smooth transitions, and with instantly switching the files as soon as another key is pressed it becomes chopped up. Should I make a timer that blocks all inputs until the animation is finished? Or is there a smarter way to do it? What do you think?
  import greenfoot.*; /** * Character that wants to shoot balloons using a slingshot. */ public class Character extends Mover { private int shotTimer = 15; private GifImage gif; private String image; public Character() { this.image = image; gif = new GifImage("Idle.gif"); setImage(gif.getCurrentImage()); gif.resume(); } public void act() { checkKeys(); shotTimer = shotTimer + 1; } private void checkKeys() { if (Greenfoot.isKeyDown("left") ) { moveLeft(); } if (Greenfoot.isKeyDown("right") ) { moveRight(); } if (Greenfoot.isKeyDown("space") && shotTimer > 15) { this.shoot(); shotTimer = 0; } } public void shoot() { this.getWorld().addObject(new Bullet(), this.getX(), this.getY()+60); } }