"Ninja Dollar" the Game for Arduino

About: My name is Simao and I love eletronics ,glass art,metal working,casting,paint ,draw...

Another video game for arduino.it's a great game is more advanced than the last I publish.Why that it is more complex than other?It is more complex because this can jump and shot and have a sound light and a new points cont method.

Supplies:

  1. Arduino.
  2. Breadboard
  3. jumper wires
  4. Red LED
  5. 2 push buttons
  6. 2 10k ohm resistors
  7. 2 220R resistors.
  8. Super bright Blue LED.
  9. piezo buzzer
  10. 16*2 LCD display

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Wiring Everything Together.

Now you need to wire everything

Step 2: How to Play:

  1. Turn on the arduino.
  2. The LCD should print : "the game starts in" and a countdown.
  3. Press one of the buttons to jump and other to shot.
  4. each block that you jump you won one point and every * that you catch gives you 5 points .
  5. When you have 50 points or higher you won

Step 3: The Code .

//este jogo e muito interessante e ao mesmo tempo irritante e frustante mas muito divertido.

#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; const int buttonPin1=1; const int buttonPin2=6; const int buzzer=7; unsigned long pts=0; //set buttonstates bool buttonState1=0; bool buttonState2=0; //random number for position of obstacles int randomNums[6]; //random number for number of obstacles int randomNum=0; //random number for position of pts int randomNums1[3]; //random number for number of pts int randomNum1=0; //start delay time, which decreases gradually unsigned int myDelay=500; //made this boolean to check if button2 is pressed because if it's pressed once in the first for loop i want obstacles not to be written until the end of it bool temp=0; //this variable stores the positions of the warrior while he shoots. there can be 16 positions because the warrior has 16 positions. int tempI[16]; //i use this boolean to check if the point is catched bool temp1=0;

//use this variable to store the position of the catched point. it must be and array to store the position of all the points in one iteration of the first for loop. if it stored just one position, then the "old" point would come back in the new iteration int tempI1[3]; //use this variable to have a number of shots of the warrior, which is also the length of an array tempI int button2IsPressed=0; LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // set buttonpin mode pinMode(buttonPin1,INPUT); pinMode(buttonPin2,INPUT); pinMode(buzzer,OUTPUT); lcd.setCursor(4,0); lcd.print("THE GAME"); lcd.setCursor(2,1); lcd.print("STARTS IN "); lcd.print("5"); delay(1000); lcd.setCursor(12,1); lcd.print("4"); delay(1000); lcd.setCursor(12,1); lcd.print("3"); delay(1000); lcd.setCursor(12,1); lcd.print("2"); delay(1000); lcd.setCursor(12,1); lcd.print("1"); delay(1000); lcd.clear();

}

void loop() { here:

randomNum=random(5); for(int i=0; i9 && pts<20) {lcd.setCursor(14,0); myDelay=400; } else if(pts>19 && pts<30) { lcd.setCursor(14,0); myDelay=300; } else if(pts>29 && pts<50) { myDelay=200; lcd.setCursor(14,0); } else if(pts>=50){ pts=0; myDelay=500; lcd.clear(); lcd.setCursor(5,0); lcd.print("VICTORY"); tone(buzzer,262); delay(200); tone(buzzer,330); delay(200); tone(buzzer,392); delay(100); tone(buzzer,330); delay(100); tone(buzzer,392); delay(100); tone(buzzer,523); delay(200); noTone(buzzer); delay(3000); lcd.clear(); goto here; } else lcd.setCursor(15,0); lcd.print(pts); buttonState1=digitalRead(buttonPin1); buttonState2=digitalRead(buttonPin2); //setting obstacles if the warrior didn't shoot or he shot but he also jumped if(!temp){ for(int j=0; jrandomNums[j]){ lcd.setCursor(randomNums[j],1); lcd.print("#"); }

} }

//setting pts if(!temp1){ for(int j=0; j

}

Games Contest

Participated in the
Games Contest

Be the First to Share

    Recommendations

    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    Discussions