Library to calculate movement and to draw the objects in the pong game
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed
Fork of MainSketch by
Diff: pong.cpp
- Revision:
- 11:d812de0e5136
- Parent:
- 10:6940a3201757
diff -r 6940a3201757 -r d812de0e5136 pong.cpp --- a/pong.cpp Wed May 24 14:52:39 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ - -#include "libs.h" -#include "ponglib.h" - -int main() { - - AnalogIn Player1(); //reading analog inputs from the potentiometers - AnalogIn Player2(); - int SCREENH = 239 ; //screen height - int SCREENW = 319 ; //screen width - int PADDLEW = 10 ; // paddle width - int PADDLEH = 40 ; // paddle height - int PADDLEG = 10 ; // paddle gap from the touchscreen - int ABALL = 10 ; // ball size - int PADDLE_A = 0 ; // location paddle A - int PADDLE_B = 0 ; // location paddle B - int PADDLE_AF = 0 ; // final location paddle A - int PADDLE_BF = 0 ; // final location paddle B - float XBALL = 0 ; // ball's x location - float YBALL = 0 ; // ball's y location - - float VXball = 3 ; // velocity in x-direction - float VYball = 2 ; // velocity in y-direction - - while(1) { - draw(); - move(); - } -} -