player 1

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

Fork of 4180FinalLab by Rishi Bhargava

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers paddle.h Source File

paddle.h

00001 #include "uLCD_4DGL.h"
00002 
00003 class Paddle 
00004 {
00005 public:
00006     // Constructors
00007     Paddle(uint8_t, uint8_t, uint8_t, uint8_t);
00008     // Set Functions
00009     void setLimits(uint8_t, uint8_t); // left and right limits of the paddle
00010     void setMaxMove(uint8_t);
00011     // Paddle location functions
00012     uint8_t getX();
00013     void setX(uint8_t);
00014     // Member Functions
00015     void move(float); // false means move left, true means move right
00016     bool checkHit(uint8_t, uint8_t, uint8_t); // Using a position and size, checks to see if something has hit the paddle
00017     uint8_t returnAngle(uint8_t, uint8_t); // Using a ball x position, gives a return vx and vxDir
00018     bool returnDir(uint8_t, uint8_t);
00019     void reset(uint8_t, uint8_t);
00020 
00021 private:
00022     // Data members are suggestions, feel free to add/remove
00023     uint8_t x;
00024     uint8_t y;
00025     uint8_t length;
00026     uint8_t width;
00027     uint8_t maxMove;
00028     uint8_t leftLim;
00029     uint8_t rightLim;
00030     bool bottom; //0 is top, 1 is bottom
00031 };
00032