top of page

To create a basic Text class out of a simple Actor class, all that needs to be done is to move the method that updates its image into the class.

​

import greenfoot.*;

​

public class Text extends Actor
{
    public void updateImage(String text)
    {
        GreenfootImage image = new GreenfootImage(text, 24, null, null);
        setImage(image);
    }
}

BUILDING A TEXT ACTOR CLASS

bottom of page