Cyber Monster Hunt - Arduino and PictoBlox Joystick Shooting Game
by rishi775 in Circuits > Arduino
40 Views, 0 Favorites, 0 Comments
Cyber Monster Hunt - Arduino and PictoBlox Joystick Shooting Game
Monster Hunter AI is an interactive shooting game built using Arduino Uno, a joystick module, and PictoBlox. The joystick controls a crosshair on the screen, allowing players to hunt randomly appearing monsters and score points.
Downloads
Supplies
PictoBlox
Arduino UNO - Rev3
1 x Joystick
5 x Jumper Wires
Connect the Joystick to Arduino
Joystick Pin/
Arduino Uno
VCC
5V
GND
GND
VRx
A0
VRy
A1
SW
D3
Connect and Upload Code
Connected to Arduino IDE and uploaded code.
void setup() {
Serial.begin(9600);
}
void loop() {
int x = analogRead(A0);
int y = analogRead(A1);
Serial.print(x);
Serial.print(",");
Serial.println(y);
delay(20);
}
Create and Program the Game Sprites
- Read joystick values from A0 and A1.
- Store values in variables.
- Map the values to stage coordinates.
- Move the crosshair accordingly.
The joystick now controls the target in real time.
- Make the monster appear at random positions.
- Continuously check whether the Aim sprite touches the monster.
- Play a sound when the monster is hit.
- Increase the score.
- Hide and respawn the monster.
This creates the shooting-game effect.
- FOR SCORES -
Create a variable called Score.
Set Score to 0 when the game starts.
Increase the score whenever the monster is hit.
Final Result
The completed project allows the player to control a crosshair using a physical joystick connected to Arduino. The game combines hardware input, real-time control, collision detection, sound effects, and scoring to create an engaging arcade-style experience.
Conclusion
This project demonstrates the integration of Arduino and PictoBlox for game development. It is an excellent beginner-friendly project for learning sensor input, hardware-software communication, and interactive game design.