
player 1
Dependencies: 4DGL-uLCD-SE PinDetect SparkfunAnalogJoystick mbed-rtos mbed SDFileSystem
Fork of 4180FinalLab by
Wireless 2 Player Pong game
paddle.h@6:9cdde66d7502, 2016-04-26 (annotated)
- Committer:
- Mpmart08
- Date:
- Tue Apr 26 18:54:13 2016 +0000
- Revision:
- 6:9cdde66d7502
- Parent:
- 4:7da18e3c590b
- Child:
- 8:8cc2aa78348c
stuff
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jlind6 | 0:356124c0bafc | 1 | #include "uLCD_4DGL.h" |
jlind6 | 0:356124c0bafc | 2 | |
jlind6 | 0:356124c0bafc | 3 | class Paddle |
jlind6 | 0:356124c0bafc | 4 | { |
jlind6 | 0:356124c0bafc | 5 | public: |
jlind6 | 0:356124c0bafc | 6 | // Constructors |
rishibhargava1 | 3:591086e44bf9 | 7 | Paddle(uint8_t, uint8_t, uint8_t, uint8_t); |
jlind6 | 0:356124c0bafc | 8 | // Set Functions |
rishibhargava1 | 3:591086e44bf9 | 9 | void setLimits(uint8_t, uint8_t); // left and right limits of the paddle |
rishibhargava1 | 3:591086e44bf9 | 10 | void setMaxMove(uint8_t); |
rishibhargava1 | 3:591086e44bf9 | 11 | // Paddle location functions |
rishibhargava1 | 3:591086e44bf9 | 12 | uint8_t getX(); |
rishibhargava1 | 3:591086e44bf9 | 13 | void setX(uint8_t); |
jlind6 | 0:356124c0bafc | 14 | // Member Functions |
rishibhargava1 | 3:591086e44bf9 | 15 | void move(float); // false means move left, true means move right |
rishibhargava1 | 3:591086e44bf9 | 16 | bool checkHit(uint8_t, uint8_t, uint8_t); // Using a position and size, checks to see if something has hit the paddle |
Mpmart08 | 4:7da18e3c590b | 17 | double returnAngle(double, double); // Using a ball x position, gives a return vx and vxDir |
rishibhargava1 | 3:591086e44bf9 | 18 | bool returnDir(uint8_t, uint8_t); |
rishibhargava1 | 3:591086e44bf9 | 19 | void reset(uint8_t, uint8_t); |
jlind6 | 0:356124c0bafc | 20 | |
jlind6 | 0:356124c0bafc | 21 | private: |
jlind6 | 0:356124c0bafc | 22 | // Data members are suggestions, feel free to add/remove |
rishibhargava1 | 3:591086e44bf9 | 23 | uint8_t x; |
rishibhargava1 | 3:591086e44bf9 | 24 | uint8_t y; |
rishibhargava1 | 3:591086e44bf9 | 25 | uint8_t length; |
rishibhargava1 | 3:591086e44bf9 | 26 | uint8_t width; |
rishibhargava1 | 3:591086e44bf9 | 27 | uint8_t maxMove; |
rishibhargava1 | 3:591086e44bf9 | 28 | uint8_t leftLim; |
rishibhargava1 | 3:591086e44bf9 | 29 | uint8_t rightLim; |
rishibhargava1 | 3:591086e44bf9 | 30 | bool bottom; //0 is top, 1 is bottom |
jlind6 | 0:356124c0bafc | 31 | }; |
jlind6 | 0:356124c0bafc | 32 |