ELEC2645 (2018/19) / Mbed 2 deprecated ml16c5l

Dependencies:   mbed

CopterEngine/CopterEngine.h

Committer:
ml16c5l
Date:
2019-04-28
Revision:
9:192ad897ec95
Parent:
8:ccf827ce0072
Child:
13:5dd6f2d443cf

File content as of revision 9:192ad897ec95:

/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name: Caiwenjing Liu
Username:ml16c5l
Student ID Number: 201165261
Date: 24/04/2019
*/



#ifndef COPTERENGINE_H
#define COPTERENGINE_H


#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Copter.h"
#include "Wall.h"


// gap from edge of screen
#define GAP 4



class CopterEngine
{

public:
    /** Constructor */
    CopterEngine();

    /** Destructor */
    ~CopterEngine();


    /** initialise Copter and wall parameters
     * @param the value of Copter_width,Copter_height,wall_size,speed.
     */
    void init(int Copter_width,int Copter_height,int wall_size,int speed);

    /** get the input of the user
     * @return input from the user
     */
    void read_input(Gamepad &pad);


    /** update the gamepad
     * @param update the gamepad when users start the game
     */
    void update(Gamepad &pad);


    /** draw all those things on the screen, which are walls and the copter
     * @param draw wall copter and so on defined in classes
     */
    void draw(N5110 &lcd);

    /** get the state of which the game is finished or not
     * @return current state of the end when the game is over
     */
    int GameOver();


    int gameover;
    int z;

private:


    // initiate all classes
    Copter _p1;
    Wall _wall;

    /** Check the screen edgess
     * @param check edge of the copter
     */
    void check_wall_edge(Gamepad &pad);

    /** Check the wall and  Copter  edges
     * @param check the edge of the copter when it collides with any wall
     */
    void check_WallCopter_edges(Gamepad &pad);

    /** Check the goal
      * @param Check how much score have the user earned
      */
    void check_goal(Gamepad &pad);
    /** Print scores on LCD
      * @param Get the score and use sprint function to print it to LCD
      */
    void print_scores(N5110 &lcd);


    int _Copter_width;
    int _Copter_height;
    int _speed;

    // x positions of the Copter
    int _posx;

    int _wall_size;



    Direction _d;
    float _mag;

};




#endif