Hello Community,
im a beginner with greenfoot and im making a simple game, but now i want to set my background(The world) to a gif i downloaded.
i tried following this this tutorial but he did it with an actor class. My background doesnt have an act method and creating one didnt really help.
how can i set a gif as my background?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Spielfeld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Spielfeld extends World
{
GifImage background = new GifImage("background.gif");
/**
* Constructor for objects of class Spielfeld.
*
*/
public Spielfeld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(640, 480, 1);
}
public void act()
{
setImage( background.getCurrentImage() );
}
}