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

2019/5/21

Regarding GIF

Joyfu1 Joyfu1

2019/5/21

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Instructions here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Instructions extends World
{
    //Defines the star in the instruction as a GIF
    GifImage animation2 = new GifImage("Instructions.gif");
    /**
     * Constructor for objects of class Instructions.
     * 
     */
    public Instructions()
    {    
        // Create a new world with instructions
        super(980, 575, 1); 
    }
 
    public void act(){
        // When space is pressed move on to MyWorld
        if ("space".equals(Greenfoot.getKey()))
        { Greenfoot.setWorld(new MyWorld());
        }
        // Gets current image of gif 
        setImage(animation2.getCurrentImage());
    }

}
setImage is underlined and it is saying "Cannot find Symbol". Not sure what the issue is here, thank you so much!
Super_Hippo Super_Hippo

2019/5/21

#
"setImage" is a method of Actor, the World's equivalent is "setBackground".
Joyfu1 Joyfu1

2019/5/21

#
Super_Hippo wrote...
"setImage" is a method of Actor, the World's equivalent is "setBackground".
Thank you so much!
You need to login to post a reply.