One player pong with seven segment display for score keeping

Dependencies:   4DGL-uLCD-SE PinDetect SDFileSystem mbed-rtos mbed wave_player

Fork of ECE2036Lab2StarterCode by Joseph Lind

Committer:
jlind6
Date:
Thu Jun 19 21:45:38 2014 +0000
Revision:
1:839d22d423bd
Parent:
0:356124c0bafc
Child:
3:c93d1b51785c
Added some clarifying comments plus changed constructors in ball.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jlind6 0:356124c0bafc 1 #include "tempModule.h"
jlind6 0:356124c0bafc 2 #include "uLCD_4DGL.h"
jlind6 0:356124c0bafc 3
jlind6 0:356124c0bafc 4 class Ball
jlind6 0:356124c0bafc 5 {
jlind6 0:356124c0bafc 6 public:
jlind6 0:356124c0bafc 7 // Constructors
jlind6 1:839d22d423bd 8 Ball ();
jlind6 1:839d22d423bd 9 Ball (float, float, int);
jlind6 1:839d22d423bd 10 /* For Part 3:
jlind6 1:839d22d423bd 11 * you need to be able to pass a pin to the
jlind6 1:839d22d423bd 12 * tempModule object from main, so you should
jlind6 1:839d22d423bd 13 * add in a PinName argument.
jlind6 1:839d22d423bd 14 */
jlind6 0:356124c0bafc 15 Ball(PinName);
jlind6 0:356124c0bafc 16 Ball(PinName, float, float, int);
jlind6 1:839d22d423bd 17 */
jlind6 0:356124c0bafc 18 // Set Functions
jlind6 0:356124c0bafc 19 void setBaseVx(float); // This sets the lowest velocity of vx (for Thermal pong) or the constant velocity
jlind6 0:356124c0bafc 20 void setBaseVy(float); // This sets the lowest velocity of vy (for Thermal pong) or the constant velocity
jlind6 0:356124c0bafc 21 void setVxSign(int);
jlind6 0:356124c0bafc 22 void setVySign(int);
jlind6 0:356124c0bafc 23 // Get Functions
jlind6 0:356124c0bafc 24 int getFutureX(); // get estimate of where the ball will be in the next update()
jlind6 0:356124c0bafc 25 int getFutureY(); // get estimate of where the ball will be in the next update()
jlind6 0:356124c0bafc 26 // Member Functions
jlind6 0:356124c0bafc 27 void reverseXDirection(); // negate the sign for when a ball hits something
jlind6 0:356124c0bafc 28 void reverseYDirection(); // negate the sign for when a ball hits something
jlind6 0:356124c0bafc 29 void reset(int, int, int, int, uLCD_4DGL *); // takes in a new location and new directions and draws the starting point for the ball
jlind6 0:356124c0bafc 30 void update(uLCD_4DGL *); // moves the ball on the screen one vx and vy
jlind6 0:356124c0bafc 31
jlind6 0:356124c0bafc 32 private:
jlind6 0:356124c0bafc 33 // Data members are suggestions, feel free to add/remove
jlind6 1:839d22d423bd 34 TempModule *tempSensor; // Pointer -- it's recommended to use "new" operator to create this
jlind6 0:356124c0bafc 35 int vxSign;
jlind6 0:356124c0bafc 36 int vySign;
jlind6 0:356124c0bafc 37 float fx;
jlind6 0:356124c0bafc 38 float fy;
jlind6 0:356124c0bafc 39 int x;
jlind6 0:356124c0bafc 40 int y;
jlind6 0:356124c0bafc 41 int radius;
jlind6 0:356124c0bafc 42 bool lose;
jlind6 0:356124c0bafc 43 };