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

2013/1/16

Timer to stop game after 60 seconds or something

1
2
danbyization danbyization

2013/1/18

#
Thanks Danpost ive done that now whats next??
danpost danpost

2013/1/18

#
danpost wrote...
Then, in your sub-class of World, add an instance Text field and create it and add the text object into the world in your world constructor, or a method it calls (like 'prepare'), and add the line to update its image.
// add world instance field
Text timerText = new Text();
// in the constructor (or a method it calls)
addObject(timerText, 100, 15); //wherever
timerText.setText("Time left: " + (timer/60));
// insert after 'timer--;' in the 'act' method (or a method it calls)
if (timer%60==0) timerText.setText("Time left: " + (timer/60));
Did you complete these steps? If so, your count-down timer should work.
danbyization danbyization

2013/1/18

#
No i didnt but now i have and it works fine thank you so much for helping me i really appreciate it
You need to login to post a reply.
1
2