I am trying to have a .gif image as background (moving water). How can i get this to work?
GifImage backgroundGif = new GifImage(filename);
setBackground(backgroundGif.getCurrentImage());
GifImage backgroundGif = new GifImage(filename);
setBackground(backgroundGif.getCurrentImage());
/**
* This method is called by the Greenfoot system when the execution has
* started. This method can be overridden to implement custom behavior when
* the execution is started.
*/
@Override
public void started() {
gackgroundGif.resume();
}
/**
* This method is called by the Greenfoot system when the execution has
* stopped. This method can be overridden to implement custom behavior when
* the execution is stopped.
*/
@Override
public void stopped() {
backgroundGif.pause();
}GifImage backgroundGif = new GifImage(filename);
setBackground(backgroundGif.getCurrentImage());
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Level3 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Level3 extends World
{
/**
* Constructor for objects of class Level3.
*
*/
public Level3()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 600, 1);
}
private void Animation(){
setBackground(backgroundGif.getCurrentImage());
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class water here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class backgroundGif extends Actor
{
GifImage backgroundGif = new GifImage("c6orUp5K3WhdS.gif");
/**
* Act - do whatever the water wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setImage( backgroundGif.getCurrentImage() );
}
}public class Level3 extends World
{
GifImage backgroundGif = new GifImage("c6orUp5K3WhdS.gif");
/**
* Constructor for objects of class Level3.
*
*/
public Level3()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 600, 1);
Animation();
}
public void Animation(){
setBackground(backgroundGif.getCurrentImage());
}
}public void act()
{
Animation();
}public void act()
{
Animation();
}