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

2014/1/5

how to make text/timer

deathburrito16 deathburrito16

2014/1/5

#
just wanted some help. thanks.
danpost danpost

2014/1/6

#
You need to create an actor class that has a method to change the image using Strings (basically, a changeable Text class). Then add an instance int field (for your timer value) and use its value as all or part of the text image for a Text object you create and save a reference to. You will probably need a second instance int field to act as a delay between the changing of the text from one unit of time to the next. Each time the delay counter reaches a specified value increment the timer value and call the method to change the text image of the Text object.
deathburrito16 deathburrito16

2014/1/6

#
how would I change the image using strings?
danpost danpost

2014/1/6

#
The 'GreenfootImage' class has a constructor that will create text images using Strings. Just create images using the text to display at the time and set that image as the image of the Actor object you are using to display the text with.
You need to login to post a reply.