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

2019/5/6

Overlapping Of Pictures (Gif)

Karsten Karsten

2019/5/6

#
Hey there :), I'm currently working on a program where a character is represented as a gif. However, when I implement the gif, the different images overlap (so that when the character is running 2 then 4 then 6 and finally 8 legs appear). Here is my code:
import greenfoot.
This is the code of the character:
[code]import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Dude here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Dude extends Actor
{
    GifImage myGif = new GifImage("Running character gif.gif");
    /**
     * Act - do whatever the Dude wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        setImage( myGif.getCurrentImage() );
    }    
}
I have implemented the default GifImage class. Thanks for helping me :)
danpost danpost

2019/5/6

#
Karsten wrote...
when I implement the gif, the different images overlap (so that when the character is running 2 then 4 then 6 and finally 8 legs appear). << Code Omitted >> I have implemented the default GifImage class.
The problem may be a World subclass one. Show its codes.
You need to login to post a reply.