code advice
shmow
Posts: 109
I've written a little "beat the clock" game.
The player has to press and hold a button for 5 seconds before the clock runs out.
I have a hub dedicated to each timer:
- one hub for the game clock which counts down to zero - timer1.
- another hub for the player's 5 sec pushbutton - timer2.
The premise is if the player holds the pushbutton down for all 5 seconds before the game's clock counts to zero then the player wins and the "computer" has lost, and...
...if the game's clock reaches zero before the player can reach 5 seconds with the pushbutton then the "computer" wins and the player has lost.
The conflict arises if the player's time with the pushbutton·reaches the 5 second at the same time as the game's clock reaches zero.
I've tried assigning variables to force one or the other.· I may even try the XOR to work in favor of the game - not truely fair.
Does anyone have any suggestions?
Much appreciated,
Shmow
The player has to press and hold a button for 5 seconds before the clock runs out.
I have a hub dedicated to each timer:
- one hub for the game clock which counts down to zero - timer1.
- another hub for the player's 5 sec pushbutton - timer2.
The premise is if the player holds the pushbutton down for all 5 seconds before the game's clock counts to zero then the player wins and the "computer" has lost, and...
...if the game's clock reaches zero before the player can reach 5 seconds with the pushbutton then the "computer" wins and the player has lost.
The conflict arises if the player's time with the pushbutton·reaches the 5 second at the same time as the game's clock reaches zero.
I've tried assigning variables to force one or the other.· I may even try the XOR to work in favor of the game - not truely fair.
Does anyone have any suggestions?
Much appreciated,
Shmow
Comments
It would be of help to post your code.
if you are using the full resolution of the cnt, the 'ties' should be highly unlikely.