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

2020/3/7

How to make a GIF world background

Yoshi21137 Yoshi21137

2020/3/7

#
I have a GIF that I want to make the background for one of my worlds but it doesn't play the GIF. Does anyone know how to fix this?
Yoshi21137 Yoshi21137

2020/3/7

#
This is my current code however it is saying that the setImage isn't a method?
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Win here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Win extends World
{
    GifImage myGif = new GifImage("Fireworks.gif");
    /**
     * Constructor for objects of class Win.
     * 
     */
    public Win()
    {    
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(1000, 650, 1); 
    }
    
    public void act()
    {
        setImage( myGif.getCurrentImage() );
    }
}
I have imported the GifImage class
Yoshi21137 Yoshi21137

2020/3/7

#
Sorry, I meant to say that the program is saying: cannot find symbol - method setImage(greenfoot.GreenfootImage)
danpost danpost

2020/3/7

#
Yoshi21137 wrote...
Sorry, I meant to say that the program is saying: cannot find symbol - method setImage(greenfoot.GreenfootImage)
The setImage method is reserved for actors. Use setBackground for the world.
Yoshi21137 Yoshi21137

2020/3/8

#
That works now, thanks so much. I also have another problem.I have an int in one of my worlds and I want to call it from another world. The code I want to use it in is
showText(""+Points, 175, 100);
That code is in a different world to the int
Yoshi21137 Yoshi21137

2020/3/8

#
Nevermind, don't need it anymore :/
You need to login to post a reply.