
player 1
Dependencies: 4DGL-uLCD-SE PinDetect SparkfunAnalogJoystick mbed-rtos mbed SDFileSystem
Fork of 4180FinalLab by
Wireless 2 Player Pong game
Diff: ball.h
- Revision:
- 0:356124c0bafc
- Child:
- 1:839d22d423bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ball.h Tue Jun 17 20:03:41 2014 +0000 @@ -0,0 +1,35 @@ +#include "tempModule.h" +#include "uLCD_4DGL.h" + +class Ball +{ +public: + // Constructors + Ball(PinName); + Ball(PinName, float, float, int); + // Set Functions + void setBaseVx(float); // This sets the lowest velocity of vx (for Thermal pong) or the constant velocity + void setBaseVy(float); // This sets the lowest velocity of vy (for Thermal pong) or the constant velocity + void setVxSign(int); + void setVySign(int); + // Get Functions + int getFutureX(); // get estimate of where the ball will be in the next update() + int getFutureY(); // get estimate of where the ball will be in the next update() + // Member Functions + void reverseXDirection(); // negate the sign for when a ball hits something + void reverseYDirection(); // negate the sign for when a ball hits something + void reset(int, int, int, int, uLCD_4DGL *); // takes in a new location and new directions and draws the starting point for the ball + void update(uLCD_4DGL *); // moves the ball on the screen one vx and vy + +private: + // Data members are suggestions, feel free to add/remove + TempModule *tempSensor; + int vxSign; + int vySign; + float fx; + float fy; + int x; + int y; + int radius; + bool lose; +};