06-11-2009 11:33 AM
Hi, I'm doing a whack-a-mole implementation and there are a few parts that I'm having problems with..
1. How to I make the 7-segment stop at 0 after the game runs for 60secs?
2. How to make the game over button light up after the game ends??
3. Replace the radio buttons and choose the levels from the user prompt instead??
Any help would be appreciated.. thanks..
Solved! Go to Solution.
06-11-2009 04:07 PM
You need to take a few steps back and think about your code. You are doing things way too complicated. For example, the stop loop and the two timer loops can be combined onto one. The loops run at a fixed pace, no need to measure time, just count iterations!
Why do you need so many stop buttons??? Why are you using such a confusing cluster ordering? Make the displayed number the same as the array index for simplicity!
This is just the toip of the iceberg, there are many more problems. Get rid of the big stacked sequence. You can define execution order with the error cluster.
06-11-2009 08:24 PM
06-12-2009 09:05 AM
06-12-2009 10:20 AM
Flibbertygibbet wrote:
estionoh and 1 more question.. how do I make the LEDs light up at random? thanks.
Your question is ambiguous:
In any case, the "dice" in the numeric palette gives you a random number between 0 and 1. You can use the output to generate either random indices or random time delays.
06-12-2009 11:40 AM
06-12-2009 12:08 PM
The numeric constant is outside the loop, so that would not work, of course.
Simply generate a random number inside the loop at each iteration and do the Q&R to get the two random indices.
If this does not make sense, show us your code again.
06-13-2009 01:39 AM
06-13-2009 04:33 AM - edited 06-13-2009 04:34 AM
You need to think this through! Once you generate random indices, you no longer need to increment anything. Why are you dividing by the random number??? You need to divide the random number by three! Some simple probing could have told you that this will not work right!
Here's a quick draft how you could do it.
Also some of your code is absolutely ridiculous. To create a string of consecutive spaces, you don't need to append N space constants. Simply use a string constant with N spaces. Right? Even better, do everything with a simple formatting operation in one step.
Also the way you built an array with two elements boggles the mind. Dont built a 1-element array and then insert the second element using "insert into array". Simply use built array with two inputs (see picture).