hello, i play a transparent gif but each frames get stuck, (the legs show previous frames even though there is a background)
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Player here. * * @author (your name) * @version (a version number or a date) */ public class Player extends Actor { boolean touched = true; //controlls static boolean playerWalking = true; GifImage LeftWalk = new GifImage("LeftWalk.gif"); GifImage RightWalk = new GifImage("RightWalk.gif"); String direction = "front"; //health static int health = 100; static int boosterhealth = 200; /** * Act - do whatever the Player wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { start(); } void start() { playerMovement(); } void playerMovement() { p_moveLeft(3); } void p_moveLeft(int speed) { if(playerWalking == true) { if(getWorld().getObjects(playerfeet.class).get(0).touchingWalkinglocation() == false) { if (direction == "front"){ setLocation(getX()-speed, getY()); } if (direction == "left"){ setLocation(getX()+speed, getY()); } if (direction == "right"){ setLocation(getX()-speed, getY()); } } if(getWorld().getObjects(playerfeet.class).get(0).touchingWalkinglocation() == true){ if (Greenfoot.isKeyDown("D") == false && Greenfoot.isKeyDown("A") == false) { if (direction == "front"){ //setImage(""); } if (direction == "left"){ setImage("idleL.png"); getImage().scale(60, 140); } if (direction == "right"){ setImage("idleR.png"); getImage().scale(50, 140); } } if(Greenfoot.isKeyDown("D")) { direction = "right"; setLocation(getX()+speed, getY()); setImage(RightWalk.getCurrentImage()); getImage().scale(200, 150); } if(Greenfoot.isKeyDown("A")) { direction = "left"; touched = false; setLocation(getX()-speed, getY()); setImage(LeftWalk.getCurrentImage()); getImage().scale(200, 150); } } } } }