Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Enemy2.h
00001 #ifndef ENEMY2_H 00002 #define ENEMY2_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 00008 const int enemy_B[7][7] = { 00009 {1,0,0,0,0,0,0}, 00010 {1,0,0,0,0,0,0}, 00011 {1,0,0,0,0,0,0}, 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_2[7][7] = { 00020 {1,1,1,1,1,1,1}, 00021 {0,0,0,0,0,0,1}, 00022 {0,0,0,0,0,0,1}, 00023 {1,1,1,1,1,1,1}, 00024 {1,0,0,0,0,0,0}, 00025 {1,0,0,0,0,0,0}, 00026 {1,1,1,1,1,1,1} 00027 00028 }; 00029 00030 const int enemy_C[7][7] = { 00031 {1,1,1,1,1,1,1}, 00032 {1,0,0,0,0,0,0}, 00033 {1,0,0,0,0,0,0}, 00034 {1,0,0,0,0,0,0}, 00035 {1,0,0,0,0,0,0}, 00036 {1,0,0,0,0,0,0}, 00037 {1,1,1,1,1,1,1} 00038 00039 }; 00040 00041 /** Enemy2 class 00042 00043 @brief Class of Enemy2 00044 00045 @version 1.0 00046 00047 @author Spencer Tingle 00048 00049 @date 09/05/19 00050 00051 */ 00052 00053 class Enemy2{ 00054 00055 public: 00056 00057 Enemy2(); 00058 ~Enemy2(); 00059 /** 00060 * @brief Init 00061 * @param x, y @details Initiates coordinates of coins 00062 */ 00063 void init(int x,int y); 00064 /** 00065 * @brief Incrementer Reset 00066 * @details Resets incrementer used for enemy movement 00067 */ 00068 void resetIncrementer(); 00069 /** 00070 * @brief Get x 00071 * @details Gets the enemy's current x-coordinate 00072 */ 00073 int get_x_enem(); 00074 /** 00075 * @brief Get y 00076 * @details Gets the enemy's current y-coordinate 00077 */ 00078 int get_y_enem(); 00079 /** 00080 * @brief Draw enemyB 00081 * @param lcd @details Draws the enemyB sprite 00082 */ 00083 void drawSpriteB(N5110 &lcd); 00084 /** 00085 * @brief Draw enemy2 00086 * @param lcd @details Draws the enemy2 sprite 00087 */ 00088 void drawSprite2(N5110 &lcd); 00089 /** 00090 * @brief Draw enemyC 00091 * @param lcd @details Draws the enemyC sprite 00092 */ 00093 void drawSpriteC(N5110 &lcd); 00094 /** 00095 * @brief Moves enemyB 00096 * @param lcd @details Moves the enemyB sprite 00097 */ 00098 void movementB(N5110 &lcd); 00099 /** 00100 * @brief Moves enemy2 00101 * @param lcd @details Moves the enemy2 sprite 00102 */ 00103 void movement2(N5110 &lcd); 00104 /** 00105 * @brief Moves enemyC 00106 * @param lcd @details Moves the enemyC sprite 00107 */ 00108 void movementC(N5110 &lcd); 00109 /** 00110 * @brief Detects collision 00111 * @param x, y, pad @details When baby and enemy collide tone plays 00112 */ 00113 bool collidePlayer(int x, int y, Gamepad &pad); 00114 00115 private: 00116 00117 int x_enem; 00118 int y_enem; 00119 int accel; 00120 int _incrementer_enem2; 00121 00122 }; 00123 00124 #endif
Generated on Wed Jul 13 2022 21:10:10 by
