ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18ajst

Dependencies:   mbed

Committer:
Albutt
Date:
Wed May 27 00:57:33 2020 +0000
Revision:
24:19994f789276
Parent:
23:9610a8f91336
Testing Documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Albutt 5:51fd6635141f 1 #include "mbed.h"
Albutt 5:51fd6635141f 2 #include "N5110.h"
Albutt 5:51fd6635141f 3 #include "Gamepad.h"
Albutt 5:51fd6635141f 4
Albutt 22:f329b05e26ff 5 /** Enemy Class:
Albutt 21:3235ac9b6e7b 6 @brief - Defines instances of Enemies for a 2D shooter game
Albutt 21:3235ac9b6e7b 7
Albutt 21:3235ac9b6e7b 8 @author Albert Tan Muligan, Student at University of Leeds
Albutt 21:3235ac9b6e7b 9 @date May 2020
Albutt 21:3235ac9b6e7b 10
Albutt 21:3235ac9b6e7b 11
Albutt 21:3235ac9b6e7b 12 */
Albutt 5:51fd6635141f 13
Albutt 5:51fd6635141f 14 class Enemy
Albutt 5:51fd6635141f 15 {
Albutt 5:51fd6635141f 16 public:
Albutt 21:3235ac9b6e7b 17 /**
Albutt 23:9610a8f91336 18 * @brief Constructor that sets inital x and y with random seed
Albutt 21:3235ac9b6e7b 19 * @param x and y @details x and y in pixels (places enemy somewhere on the edge of a 84x48 board)
Albutt 21:3235ac9b6e7b 20 */
Albutt 6:546eba371942 21 Enemy(int seed);
Albutt 5:51fd6635141f 22 ~Enemy();
Albutt 5:51fd6635141f 23 void draw(N5110 &lcd);
Albutt 5:51fd6635141f 24 void update(int player_x, int player_y);
Albutt 21:3235ac9b6e7b 25 ///X value accessor
Albutt 5:51fd6635141f 26 int get_x();
Albutt 21:3235ac9b6e7b 27 ///Y value accessor
Albutt 5:51fd6635141f 28 int get_y();
Albutt 21:3235ac9b6e7b 29 /**
Albutt 23:9610a8f91336 30 * @brief Mutator to reset enemy to edge with random seed, and creates an animation on death
Albutt 21:3235ac9b6e7b 31 * @param seed, lcd @details integer seed and pointer to lcd
Albutt 21:3235ac9b6e7b 32 */
Albutt 14:2d7e41f46879 33 void reset(int seed, N5110 &lcd);
Albutt 5:51fd6635141f 34 private:
Albutt 21:3235ac9b6e7b 35 ///small animation on death
Albutt 15:3dbb3f4d7ae6 36 void death_animation(N5110 &lcd);
Albutt 5:51fd6635141f 37 int _x;
Albutt 5:51fd6635141f 38 int _y;
Albutt 5:51fd6635141f 39 int _speed;
Albutt 14:2d7e41f46879 40 int _four;
Albutt 5:51fd6635141f 41 };