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
Diff: ball.h
- Revision:
- 3:c93d1b51785c
- Parent:
- 1:839d22d423bd
diff -r 6163865f5ce3 -r c93d1b51785c ball.h --- a/ball.h Fri Jun 20 15:22:28 2014 +0000 +++ b/ball.h Thu Mar 17 20:38:26 2016 +0000 @@ -1,43 +1,61 @@ #include "tempModule.h" #include "uLCD_4DGL.h" +#include "paddle.h" class Ball { -public: +public: + // Constructors - Ball (); - Ball (float, float, int); - /* For Part 3: - * you need to be able to pass a pin to the - * tempModule object from main, so you should - * add in a PinName argument. - */ + + Ball(); Ball(PinName); - Ball(PinName, float, float, int); - */ + Ball(PinName,float, float); + // 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); + void setVx(float);// This sets the lowest velocity, for Thermal pong, or the constant velocity of x + void setVy(float);// This sets the lowest velocity, for Thermal pong, or the constant velocity of y + void setXSign(int); + void setYSign(int); + void setRadius(int); + void setFx(float); + void setFy(float); + void setX(int); + void setY(int); + void setLose(bool); + // 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() + int getFutureX();// calculate new X position + int getFutureY();// calculate new Y position + int getXSign(); + int getYSign(); + int getRadius(); + int getX(); + int getY(); + float getFx(); + float getFy(); + float getVx(); + float getVy(); + bool getLose(); + // 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 + void reverseXDirection();// negate the sign when ball hits wall or paddle + void reverseYDirection();// negate the sign when ball hits wall or paddle + void startPong(int, uLCD_4DGL *);// initialize starting pointion for the ball + void update(uLCD_4DGL *);// moves the ball on the screen + void resetBall(); + void testConditions(Paddle *,uLCD_4DGL *); private: - // Data members are suggestions, feel free to add/remove - TempModule *tempSensor; // Pointer -- it's recommended to use "new" operator to create this - int vxSign; - int vySign; + TempModule *tempSensor; + int xSign; + int ySign; float fx; float fy; + float vx; + float vy; int x; int y; int radius; bool lose; -}; +}; \ No newline at end of file