Shop OBEX P1 Docs P2 Docs Learn Events
I need help making a game — Parallax Forums

I need help making a game

darkness5646darkness5646 Posts: 2
edited 2011-04-25 10:31 in BASIC Stamp
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 :)

Comments

  • FranklinFranklin Posts: 4,747
    edited 2011-04-09 20:08
    Let's start with the code you have (either attach the program or enclose your code with code tags (found in the advanced editing options)) and how you have things connected.
  • darkness5646darkness5646 Posts: 2
    edited 2011-04-09 20:19
    Oh no, I didn't copy the code to my USB. I was working on the game at school and I didn't copy the code to my USB; it's on my home drive at school.

    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.
  • FranklinFranklin Posts: 4,747
    edited 2011-04-09 20:23
    Well then, send an output to p0-3 as a nibble with one bit on then read a nibble from p4-8 and check to see if it is the same. The manual should help with this.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-09 20:26
    You won't learn much by having someone else code your stuff for you. If it's a homework assignment, you could get an F for cheating (having someone else do your work for you).

    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.
  • Qwaszx72Qwaszx72 Posts: 30
    edited 2011-04-25 10:31
    Like Mike said, you should try to do this on your own. But because it seems like you need help, I'll help you.
    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
Sign In or Register to comment.