ELEC2645 (2018/19) / Mbed 2 deprecated el17set_

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Enemy1.h Source File

Enemy1.h

00001 #ifndef ENEMY1_H
00002 #define ENEMY1_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 
00008 const int enemy_A[7][7] = {
00009   {0,0,1,1,1,1,1},
00010   {0,0,0,0,0,0,1},
00011   {0,0,0,0,0,0,1},
00012   {1,1,1,1,1,1,1},
00013   {1,0,0,0,0,0,1},
00014   {1,0,0,0,0,0,1},
00015   {1,1,1,1,1,1,1}
00016 
00017   };
00018 
00019 const int enemy_1[7][7] = {
00020   {1,1,1,1,0,0,0},
00021   {0,0,0,1,0,0,0},
00022   {0,0,0,1,0,0,0},
00023   {0,0,0,1,0,0,0},
00024   {0,0,0,1,0,0,0},
00025   {0,0,0,1,0,0,0},
00026   {1,1,1,1,1,1,1}
00027 
00028   };
00029 
00030 /** Enemy1 class
00031 
00032 @brief Class of Enemy1
00033 
00034 @version 1.0
00035 
00036 @author Spencer Tingle
00037 
00038 @date 09/05/19
00039 
00040 */
00041 
00042 class Enemy1{
00043 
00044  public:
00045 
00046   Enemy1();
00047   ~Enemy1();
00048   /** 
00049   * @brief Init
00050   * @param x, y @details Initiates coordinates of coins
00051   */
00052   void init(int x,int y);
00053   /** 
00054   * @brief Incrementer Reset
00055   * @details Resets incrementer used for enemy movement
00056   */
00057   void resetIncrementer();
00058   /** 
00059   * @brief Get x
00060   * @details Gets the current x-coordinate
00061   */
00062   int get_x_enem();
00063   /** 
00064   * @brief Get y
00065   * @details Gets the current y-coordinate
00066   */
00067   int get_y_enem();
00068   /** 
00069   * @brief Draw enemyA
00070   * @param lcd @details Draws the enemyA sprite
00071   */
00072   void drawSpriteA(N5110 &lcd);
00073   /** 
00074   * @brief Draw enemy1
00075   * @param lcd @details Draws the enemy1 sprite
00076   */
00077   void drawSprite1(N5110 &lcd);
00078   /** 
00079   * @brief Moves enemyA
00080   * @param lcd @details Moves the enemyA sprite
00081   */
00082   void movementA(N5110 &lcd);
00083   /** 
00084   * @brief Moves enemy1
00085   * @param lcd @details Moves the enemy1 sprite
00086   */
00087   void movement1(N5110 &lcd);
00088   /** 
00089   * @brief Detects collision
00090   * @param x, y, pad @details When baby and enemy collide tone plays
00091   */
00092   bool collidePlayer(int x, int y, Gamepad &pad);
00093 
00094  private:
00095 
00096   int x_enem;
00097   int y_enem;
00098   int accel;
00099   int _incrementer_enem1;
00100 
00101 };
00102 
00103 #endif