ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19zf

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Collision.h Source File

Collision.h

00001 #ifndef COLLISION_H
00002 #define COLLISION_H
00003 
00004 #include "mbed.h"
00005 #include "Gamepad.h"
00006 #include "N5110.h"
00007 #include "PeopleEngine.h"
00008 #include "shot.h"
00009 
00010 /** Collision class
00011  *@brief check whether people is shotted
00012  *@author Zeyu Feng
00013  *@28 April 2020
00014  */
00015    
00016 class Collision{
00017     
00018 public:    
00019     /**constructor*/
00020     Collision();
00021     /**destructor*/
00022     ~Collision();
00023     
00024     /**init private variables*/
00025     void init();
00026     
00027     /**reset col_index to 0*/
00028     void reset_check_col();
00029     
00030     /**check whether there is a collision
00031     *@return whether collide
00032     */
00033     bool check(N5110 &lcd);
00034     
00035     /**check whether people reach destination
00036     *@return whether reach destination
00037     */
00038     bool check_des(N5110 &lcd);
00039     
00040     /**draw current health at the left top of lcd*/
00041     void draw(N5110 &lcd);
00042     
00043     /**draw basic elements in collision interface*/
00044     void draw_basic(N5110 &lcd);
00045     
00046     /**draw the collision interface to tell gamer health - 1*/
00047     void draw_collision(N5110 &lcd);
00048     
00049     /**accessors get health of people
00050     *@return health of people
00051     */
00052     int get_health();
00053     
00054     /**accessors get des_index
00055     *@return game information
00056     */
00057     int get_des();
00058     /**accessors get col_index
00059     *@return game information
00060     */
00061     bool get_check_col();
00062     
00063     /**accessors*/
00064     void set_pos(Vector2D pos);
00065     
00066 private:
00067     
00068     int _health;
00069     int _check_col_index;
00070     int _check_des_index;
00071     
00072     Vector2D _people_pos;//starting coordinate
00073     
00074 };
00075 #endif
00076     
00077     
00078     
00079 
00080