I need help making a game
darkness5646
Posts: 2
Hi, I'm trying to make a basic game using BASIC stamp. The board is the one that comes with the 15 LEDs and I'm trying to make a game that uses four LEDs, LED 0 to 3, and four buttons.
I want to make it so that there is only one LED on at a time, but I'm using a random value and the random value is causing multiple LEDs to turn on at once. I'm trying to make it so that only one LED comes on and if the user presses the button with the same number as the LED, they win.
So, if LED 0 comes on and the player presses button 0 then the score will increment by 1 and be displayed in a 7-segment display. If LED 1 comes on and the user press button 1 then etc, etc..
I need help coding it, I'm very bad at Parallax coding and I would appreciate it if someone were to code this game for me so that I can learn how to code a game. Please explain your code so that I can learn from it and make the game better.
Thanks
I want to make it so that there is only one LED on at a time, but I'm using a random value and the random value is causing multiple LEDs to turn on at once. I'm trying to make it so that only one LED comes on and if the user presses the button with the same number as the LED, they win.
So, if LED 0 comes on and the player presses button 0 then the score will increment by 1 and be displayed in a 7-segment display. If LED 1 comes on and the user press button 1 then etc, etc..
I need help coding it, I'm very bad at Parallax coding and I would appreciate it if someone were to code this game for me so that I can learn how to code a game. Please explain your code so that I can learn from it and make the game better.
Thanks
Comments
It doesn't matter anyway since I kept deleting the code whenever it didn't work and the only thing that I had left were variables and an infinite do loop.
As for wiring, I have 4 white wires that are connected from the pins, P0 - P3 to the LED pins, LED 0 - LED 3. I also have 4 orange wires connecting from P4 - P8 to Buttons 0 to 3.
How about if you make a schematic drawing, scan it in, and attach the scanned image to a reply using the Attachment Manager that Franklin mentioned (when you click the "Go Advanced" button.
Here is a code that returns a nibble sized value with only 1 bit on:
Random_Value VAR Word
Random_Value = 12345 'This could be any number...it doesn't matter
Lights VAR Nib
Get_Lights_Value:
Random Random_Value
Lights = 2 ^ (Random_Value // 4)
Return