Add an LCD to your Esplora and you have a standalone gaming platform |
So I contacted David and he sent me over the code the other day. David stated the code was not textbook code - besides adding Esplora button presses, I did some reformatting and documentation.
The Arduino may be powered by a USB cable to your PC, a USB phone brick, or a phone backup battery.
So here I present the classic one-player Pong game. It uses the Esplora right-hand buttons 2 and 4 (up and down) to allow the player to move their paddle up and down. First player to 5 wins. The Arduino plays a good game but can make some bonehead moves every now and then - definitely not easy to beat it.
To start a new game, you press the right button (labeled Switch 3).
Player's paddle on screen is on the left, control buttons to the right. Excuse my photography... |
You can mod the game but it may not be the simplest process. I looked into use of the joystick for paddle control and I found it sluggish. The game may be sped up by not drawing the lines and score after every ball move. Perhaps the gameplay calculation conditional statements could be a bit clearer. If you do speed up the game, you should have something to govern the ball speed - I would suggest the slider below the display controlling a delay.
If you want a cleaner version of the code, the official Arduino.cc website has a version of Pong at https://www.arduino.cc/en/Tutorial/EsploraTFTPong
esplora + lcd screen = unstopable!!!!
ReplyDelete