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

2013/2/11

One Random Number

SunnyD212 SunnyD212

2013/2/11

#
I am currently trying to create a game that involves matching numbers by adding to the correct sum. The main problem is, when I have the goal number randomized and displayed, it continues to show a new number as the game runs. This makes it impossible to match. I want to be able to have just one number appear that the player must match, but I'm not sure how to do this. Any help would be greatly appreciated!
danpost danpost

2013/2/11

#
You probably just need to qualify (add a condition to regulate) showing of a new number by asking if a number is already there or not. In pseudo-code: "If no goalNumber object is in the world, add a new goalNumber object to the world." With this, all you have to do is, when you are done with one, remove that goalNumber object from the world.
You need to login to post a reply.