Library containing the Game Engine

Committer:
ll14c4p
Date:
Thu May 04 11:36:35 2017 +0000
Revision:
13:63013a418903
Parent:
12:6eeb06ed7c6b
+Deoxygen

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ll14c4p 0:5997fa876927 1 #ifndef GAMEENGINE_H
ll14c4p 0:5997fa876927 2 #define GAMEENGINE_H
ll14c4p 0:5997fa876927 3
ll14c4p 0:5997fa876927 4 #include "mbed.h"
ll14c4p 0:5997fa876927 5 #include "N5110.h"
ll14c4p 0:5997fa876927 6 #include "Gamepad.h"
ll14c4p 0:5997fa876927 7 #include "Player.h"
ll14c4p 3:2f8f003ce4fd 8 #include "Projectile.h"
ll14c4p 6:c710fbc0f48e 9 #include "Target.h"
ll14c4p 10:df8ea4e747e2 10 #include "HealthBar.h"
ll14c4p 0:5997fa876927 11
ll14c4p 0:5997fa876927 12 class GameEngine
ll14c4p 0:5997fa876927 13 {
ll14c4p 0:5997fa876927 14 public:
ll14c4p 0:5997fa876927 15 GameEngine();
ll14c4p 0:5997fa876927 16 ~GameEngine();
ll14c4p 11:832eb031310b 17
ll14c4p 11:832eb031310b 18 /** Initialise Game Engine
ll14c4p 11:832eb031310b 19 *
ll14c4p 13:63013a418903 20 * This function initialises the game engine.
ll14c4p 11:832eb031310b 21 */
ll14c4p 0:5997fa876927 22 void init( );
ll14c4p 11:832eb031310b 23
ll14c4p 11:832eb031310b 24 /** Read Input
ll14c4p 11:832eb031310b 25 *
ll14c4p 13:63013a418903 26 * This function obtains numeric data from the gamepads joystick.
ll14c4p 11:832eb031310b 27 */
ll14c4p 0:5997fa876927 28 void read_input(Gamepad &pad);
ll14c4p 11:832eb031310b 29
ll14c4p 11:832eb031310b 30 /** Update
ll14c4p 11:832eb031310b 31 *
ll14c4p 13:63013a418903 32 * This function contains the update functions of the other libraries used in the game.
ll14c4p 11:832eb031310b 33 */
ll14c4p 0:5997fa876927 34 void update(Gamepad &pad);
ll14c4p 11:832eb031310b 35
ll14c4p 11:832eb031310b 36 /** Draw
ll14c4p 11:832eb031310b 37 *
ll14c4p 13:63013a418903 38 * This function contains the draw functions of the other libraries used in the game.
ll14c4p 11:832eb031310b 39 */
ll14c4p 8:bd718162a87c 40 void draw(N5110 &lcd, Gamepad &pad);
ll14c4p 11:832eb031310b 41
ll14c4p 11:832eb031310b 42 /** Get Position
ll14c4p 11:832eb031310b 43 *
ll14c4p 13:63013a418903 44 * This function contains the Get Position functions of the otehr libraries used in the game.
ll14c4p 11:832eb031310b 45 */
ll14c4p 1:13a97de95e46 46 void get_pos();
ll14c4p 11:832eb031310b 47
ll14c4p 11:832eb031310b 48
ll14c4p 5:6224122fc07c 49 int playerx;
ll14c4p 5:6224122fc07c 50 int playery;
ll14c4p 12:6eeb06ed7c6b 51 int score;
ll14c4p 0:5997fa876927 52
ll14c4p 0:5997fa876927 53 private:
ll14c4p 0:5997fa876927 54
ll14c4p 0:5997fa876927 55 Player _p;
ll14c4p 3:2f8f003ce4fd 56 Projectile _proj;
ll14c4p 6:c710fbc0f48e 57 Target _t;
ll14c4p 8:bd718162a87c 58 Target _tt;
ll14c4p 8:bd718162a87c 59 Target _ttt;
ll14c4p 10:df8ea4e747e2 60 HealthBar _hb;
ll14c4p 0:5997fa876927 61 int _speed;
ll14c4p 0:5997fa876927 62 Direction _d;
ll14c4p 0:5997fa876927 63 float _mag;
ll14c4p 13:63013a418903 64
ll14c4p 13:63013a418903 65 /** Check for Projectile and Target collision
ll14c4p 13:63013a418903 66 *
ll14c4p 13:63013a418903 67 * This function checks if the projectile has come into contact with a target.
ll14c4p 13:63013a418903 68 */
ll14c4p 7:cf6304ef44fd 69 void CheckProjTargetCollision(Gamepad &pad);
ll14c4p 13:63013a418903 70
ll14c4p 13:63013a418903 71 /** Check for Player and Target collision
ll14c4p 13:63013a418903 72 *
ll14c4p 13:63013a418903 73 * This function checks if the player has come into contact with a target.
ll14c4p 13:63013a418903 74 */
ll14c4p 8:bd718162a87c 75 void CheckPlayerTargetCollision(Gamepad &pad);
ll14c4p 13:63013a418903 76
ll14c4p 13:63013a418903 77 /** Check for Target and Floor collision
ll14c4p 13:63013a418903 78 *
ll14c4p 13:63013a418903 79 * This function checks if the target sprite has reached the bottom of the screen.
ll14c4p 13:63013a418903 80 */
ll14c4p 10:df8ea4e747e2 81 void CheckTargetFloorCollision(Gamepad &pad);
ll14c4p 10:df8ea4e747e2 82 int HP;
ll14c4p 10:df8ea4e747e2 83 int n;
ll14c4p 10:df8ea4e747e2 84 int HPLost1;
ll14c4p 10:df8ea4e747e2 85 int HPLost2;
ll14c4p 0:5997fa876927 86
ll14c4p 0:5997fa876927 87 };
ll14c4p 0:5997fa876927 88 #endif