Initial publish
Dependencies: mbed
Fork of el17dg by
Diff: game/boss.h
- Revision:
- 36:207ec7db8648
- Parent:
- 35:172db1608332
- Child:
- 37:6a2bf4488022
--- a/game/boss.h Tue Apr 30 20:51:39 2019 +0000 +++ b/game/boss.h Thu May 02 13:35:22 2019 +0000 @@ -2,8 +2,6 @@ #define BOSS_H #include "constants.h" -#include "player.h" -#include "stars.h" /** * Boss Class @@ -80,7 +78,7 @@ else{ GameGlobals::game_score += 300; GameGlobals::score_count_for_boss_mode = 0; - active = false; + updateAndDrawDeathExplosion(); lcd.normalMode(); } return active; @@ -99,7 +97,10 @@ animation_counter = 0; active = true; boss_lives = 10; + dead_counter = 4; + #ifdef DEBUGel17dg printf("boss lives set to: %i \n", boss_lives); + #endif return; } if (animation_counter < animation_length) { @@ -124,6 +125,23 @@ int boss_lives; private: + void updateAndDrawDeathExplosion() { + for(int dead_counter; dead_counter >= 0; dead_counter--){ + if (dead_counter > 0) { + if (dead_counter == 4){ + drawSpriteOnTop(pos, enemy1_quarter_exploded_sprite); + } else if (dead_counter == 3){ + drawSpriteOnTop(pos, enemy1_half_exploded_sprite); + } else if (dead_counter == 2){ + drawSpriteOnTop(pos, enemy1_second_quarter_exploded_sprite); + } else if (dead_counter == 1){ + drawSpriteOnTop(pos, enemy1_fully_exploded_sprite); + } + } else { + active = false; + } + } + } /** * @brief Spawns a blast at the position of the boss. @@ -153,12 +171,13 @@ } static const int boss_y_speed = 2; static const int boss_blast_speed = 4; + static const int animation_length = 20; bool dead(){return boss_lives == 0;} bool started_cutscene; bool switch_boss_y_dir; int blast_countdown; int animation_counter; - static const int animation_length = 20; + int dead_counter; }; #endif \ No newline at end of file