ELEC2645 (2018/19) / Mbed 2 deprecated ml16c5l

Dependencies:   mbed

Revision:
9:192ad897ec95
Parent:
8:ccf827ce0072
Child:
13:5dd6f2d443cf
--- a/CopterEngine/CopterEngine.h	Mon Apr 22 03:37:34 2019 +0000
+++ b/CopterEngine/CopterEngine.h	Sun Apr 28 21:32:06 2019 +0000
@@ -1,12 +1,28 @@
+/*
+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 "Walls.h"
+#include "Wall.h"
+
 
+// gap from edge of screen
+#define GAP 4
 
 
 
@@ -14,8 +30,88 @@
 {
 
 public:
-   /** Constructor */
+    /** Constructor */
     CopterEngine();
-   
-   /** Destructor */
-    ~CopterEngine();
\ No newline at end of file
+
+    /** 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