Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
CopterEngine/CopterEngine.h
- Committer:
- ml16c5l
- Date:
- 2019-05-08
- Revision:
- 16:fda4c36bffe9
- Parent:
- 15:997278891dc1
- Child:
- 17:b385e6ae8ef4
File content as of revision 16:fda4c36bffe9:
/*
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
/** CopterEgine Class
@author Caiwenjing Liu, University of Leeds
@brief the code of copter for the CopterGame
@date 11/04/2019
*/
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