PDA

View Full Version : Please help me with this game


monstez88
09-05-2008, 12:36 PM
Hi, I really need urgent help. I'm trying to make a game, which goes like this:
- A no. of bunny appears for a brief moment
- All bunnies disappeared
- Ask user how many bunnies are there
I used a list for the bunnies, and for the disappear part, I used random isShowing is false. Now the thing is, how am I suppose to put the no. of bunnies that appear into, I dunno, a variable or something so that I can tally it with the user's answer and so on.

Is it very confusing? Can anyone please help? Really appreciated! I've attached my quarter done code.

jmdrake
09-11-2008, 10:49 AM
Hello,

First you need to add a property variable "bunnyCount" to the "world" object. Right now you've created a "count" method and you have a "bunnyCount" variable there. You're "count" method isn't needed.

Next bunnyCount needs to be initialized. Do this by adding the following code to your showBunny method:

world.bunnyCount set value to 11

After that you need to decrement bunnyCount everytime you hide a bunny. That's a little difficult (for me anyway) the way you currently have your hideBunny code. Instead of:

random item from world.bunyList set isShowing to false

I did used a probability function.

If choose true 50% of the time
item_from_bunnyList set isShowing to false
decrement world.bunnyCount by 1