ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19zf

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers People.h Source File

People.h

00001 #ifndef PEOPLE_H
00002 #define PEOPLE_H
00003 
00004 #include "mbed.h"
00005 #include "Gamepad.h"
00006 #include "N5110.h"
00007 
00008 /** People class
00009 @brief set a basic element of my project
00010 @author Zeyu Feng
00011 @9 April 2020
00012 */
00013 
00014 class People {
00015 
00016 public:
00017     /**Constructor*/
00018     People();
00019     
00020     /**Destructor*/    
00021     ~People(); 
00022     
00023     /**initialize the position of people*/
00024     void init();
00025     
00026     /**draw it on lcd and alternating type of people when running
00027     *@param lcd
00028     *@param type flag of people
00029     */
00030     void draw(N5110 &lcd,int flag);
00031     
00032     /**update the position of people*/
00033     void update();
00034     /** limit the people without going off screen*/
00035     void control_lim();
00036         
00037     /**accessors   set the position of people only for test
00038     *@param pos(Vector2D)
00039     */
00040     void set_pos(Vector2D p);
00041     /**accessors   control the people by Joystick
00042     *@param Direction (Direction)
00043     *@param Mag(float)
00044     */  
00045     void set_velocity(Direction d,float mag);//control by gamepad
00046         
00047     /**mutators get the position of people only for test
00048     *@return pos(Vector2D)
00049     */
00050     Vector2D get_pos();
00051        
00052 private:
00053     Direction _d;
00054     float _mag;
00055     int _x;
00056     int _y;
00057     int _index;//choose the type of people
00058 };
00059 #endif
00060