Albert Tan-Mulligan / Mbed 2 deprecated ELEC2645_Project_el18ajst

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Enemy.h Source File

Enemy.h

00001 #include "mbed.h"
00002 #include "N5110.h"
00003 #include "Gamepad.h"
00004 
00005 /** Enemy Class:
00006 @brief  - Defines instances of Enemies for a 2D shooter game
00007 
00008 @author Albert Tan Muligan, Student at University of Leeds
00009 @date May 2020
00010 
00011 
00012 */ 
00013 
00014 class Enemy
00015 {
00016 public:
00017     /** 
00018   * @brief Constructor that sets inital x and y with random seed
00019   * @param x and y  @details x and y in pixels (places enemy somewhere on the edge of a 84x48 board)
00020   */
00021     Enemy(int seed);
00022     ~Enemy();
00023     void draw(N5110 &lcd);
00024     void update(int player_x, int player_y);
00025     ///X value accessor
00026     int get_x();
00027     ///Y value accessor
00028     int get_y();
00029      /** 
00030   * @brief Mutator to reset enemy to edge with random seed, and creates an animation on death
00031   * @param seed, lcd  @details integer seed and pointer to lcd
00032   */
00033     void reset(int seed, N5110 &lcd);
00034 private:
00035     ///small animation on death
00036     void death_animation(N5110 &lcd);
00037     int _x;
00038     int _y;
00039     int _speed;
00040     int _four;
00041 };