Ben Evans / Mbed 2 deprecated Defender_Game

Dependencies:   mbed

People/People.h

Committer:
evanso
Date:
2020-05-15
Revision:
34:85ccc16f24d2
Parent:
33:7fedd8029473
Child:
35:577c65bf914e

File content as of revision 34:85ccc16f24d2:

#ifndef PEOPLE_H
#define PEOPLE_H
 
// Included libraries ----------------------------------------------------------
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "RandomMovement.h"
#include "Alien.h"


/** People class
 * @brief Draws people and moves them if collected by aliens
 * @author Benjamin Evans, University of Leeds
 * @date May 2020
 */ 
class People: public RandomMovement {
    public:
        /** Constructor */
        People();
        
        /** Destructor */
        ~People();
        
        /** Initalises Alien 
         * @param position_x_start @details Random x start pos of people
         */
        void init(Gamepad &pad, int position_x_start);
        
        /** Draws the people
         * @param lcd @details N5110 object
         */
        void draw_people(N5110 &lcd, Direction d_, int map_length_, 
        int position_x_map_);
        
        /** Checks if alien collides with a people
         * @param alien @details Alien object
         */
        bool check_alien_collision(Alien alien);
    
    // Accessors and mutators --------------------------------------------------
        
        /** Gets alien collision flag
         * @return alien_collision_flag
         */
        bool get_alien_collision_flag();
        
    private:
    // Function prototypes -----------------------------------------------------
        
        /** Stops the people from moving off the edge of the map and moves 
         * people if the map loops
         * @param map_length_@details : length of the map  
         * @param position_x_map_ @detials : the drawing start posisiton of the 
         * map 
         */
        void off_screen_x_y_checker(int map_length_, int position_x_map_);
        
    // Variables ---------------------------------------------------------------
         
        /** Flag if there is is a alien collision*/
        bool alien_collision_flag;
        
        /** People movement counter */
        int people_move_counter_; 
        
};
 
#endif