Color Seeker: an mbed game
Color Seeker is an mbed game that utilizes various external I/O devices used by ECE 4180 students at Georgia Tech.
The particular components involved are listed below with links to Wiki pages or data sheets.
Sharp IR Sensor: http://sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0a21yk_e.pdf
ShiftBrite RGB LED: https://developer.mbed.org/users/4180_1/notebook/shiftbrite1/
Simple Push Buttons: https://developer.mbed.org/users/4180_1/notebook/pushbuttons/
SD Card: http://developer.mbed.org/cookbook/SD-Card-File-System
For this specific game, here are the proper pin assignments for each component:
If using the ribbon cable with the uLCD, the TX and RX labels are swapped, but the order of the pins is the same, so simply connect the pins to the mbed in order.
It's a good idea to secure the IR sensor to the breadboard using some jumper wires for playability:
The ShiftBrite is mainly for visual effect, it is not completely essential for gameplay.
mbed's internal pullups are utilized in this program, so external pullups are unnecessary.
The SD card is required for storing high scores (and potentially player-modifiable game settings).
The primary objective across all game modes is hitting as many colored tiles as possible. There are 9 tile spaces on the screen in a 3x3 grid, and each of the three columns corresponds to an external push button (the leftmost column is red/button1, the middle is green/button2, and the rightmost is blue/button3). One of these tiles appears at a time, and to hit the tile, the player uses the IR sensor to move the yellow cursor up and down to select the desired row, then pushes the push button corresponding to the desired color/column.
There are three game modes that provide variations on the core gameplay.
Pressing Button 1 on the main menu enters Survival mode. In this game mode, the player has an unlimited amount of time to correctly hit as many tiles as possible. Each time the player incorrectly hits a tile, a life is lost, and when all lives are lost, the game is over.
Though there is no limit on total gameplay time, there is a limit to the amount of time the player has to hit the current tile. This limit decreases slightly as the player's score increases. If the player takes too long to hit a tile, it is treated as an incorrect hit.
Pressing Button 2 on the main menu enters Speed mode. In this game mode, the player has a certain amount of time to correctly hit as many tiles as possible. When time runs out, the game is over.
There is no penalty for incorrect tiles other than the time wasted by incorrectly hitting a tile.
Pressing Button 3 on the main menu enters Sequence mode. In this game mode, instead of displaying a single tile to be hit, the game plays a sequence of tiles, and the player needs to remember the sequence and echo it correctly in order to receive a point. The initial sequence is one tile long, and following each correct echoing of the given sequence by the player, an additional tile is appended to the existing sequence. If the player incorrectly echoes the sequence, a life is lost, and the game replays the existing sequence (without appending an additional tile) and again prompts the user to echo it. When all lives are lost, the game is over.
This game mode is analogous to the popular electronic game Simon.
There is no restriction on the amount of time the player has to echo the sequence.
This video demonstrates all three game modes.
Get the program here:
A game for mbed involving various external I/O used in ECE 4180 at Georgia Tech.
Current Version: 1.1
-High Scores now save and load properly
-Player modifiable settings that can be configured prior to gameplay (number of lives, gameplay time, difficulty)
-Game sounds using a speaker
Please log in to post comments.