god angry

This commit is contained in:
Thomas 2022-01-06 17:27:07 +01:00
parent bdbcd4eec2
commit c85d677afa
No known key found for this signature in database
GPG Key ID: E538821A6CDFDAD7
5 changed files with 14 additions and 9 deletions

View File

@ -11,6 +11,7 @@ enum class GodState{
RETRIEVE1, RETRIEVE1,
RETRIEVE2, RETRIEVE2,
THROW, THROW,
YOLO,
}; };
// I don't want to put that in config, I feel like it would be useless and overkill at this point // I don't want to put that in config, I feel like it would be useless and overkill at this point
#define GOD_BENCH_SIZE 64 #define GOD_BENCH_SIZE 64

View File

@ -65,7 +65,7 @@ public:
void drawGodRightHand(const Position& pos) const; void drawGodRightHand(const Position& pos) const;
void drawGodLeftHand(const Position& pos) const; void drawGodLeftHand(const Position& pos) const;
void drawGodFace(int y) const; void drawGodFace(int y, bool angry=false) const;
private: private:
// Explanation for choices : // Explanation for choices :

View File

@ -102,10 +102,11 @@ void PixelManager::drawGodLeftHand(const Position& pos) const {
drawSprite(leftHand, pos); drawSprite(leftHand, pos);
} }
void PixelManager::drawGodFace(int y) const { void PixelManager::drawGodFace(int y, bool angry) const {
Text t( Text t(
Position(getScreenWidth()/2, y), Position(getScreenWidth()/2, y),
".w.", nsGraphics::KBlue, angry ? ">w<" : ".w.",
nsGraphics::KBlue,
GlutFont::GlutFonts::BITMAP_TIMES_ROMAN_24, GlutFont::GlutFonts::BITMAP_TIMES_ROMAN_24,
Text::HorizontalAlignment::ALIGNH_CENTER Text::HorizontalAlignment::ALIGNH_CENTER
); );

View File

@ -17,7 +17,7 @@ void PixelManager::displayMenu(const Position& pos, Menu& currentMenu){
startFrame(); startFrame();
size_t margin = 0; size_t margin = 0;
size_t cpt = 0; size_t cpt = 0;
for(auto& value : currentMenu.entries ){ for(string& value : currentMenu.entries ){
displayButton(Position(0,0+margin)+ pos, value, (currentMenu.currentValue == cpt) ? currentMenu.selectedColor : currentMenu.unSelectedColor ); displayButton(Position(0,0+margin)+ pos, value, (currentMenu.currentValue == cpt) ? currentMenu.selectedColor : currentMenu.unSelectedColor );
++cpt; ++cpt;
margin += 50; margin += 50;

View File

@ -54,7 +54,7 @@ bool Game::manageGod() {
god.counter -= 2; god.counter -= 2;
return false; return false;
} }
if(god.thrownInvType==InvaderType::NONE){ if (god.thrownInvType == InvaderType::NONE) {
god.state = GodState::WAIT; god.state = GodState::WAIT;
return false; return false;
} }
@ -89,12 +89,12 @@ bool Game::manageGod() {
bool touched = false; bool touched = false;
// check if OOB (Out Of Bounds) // check if OOB (Out Of Bounds)
if (invaderPos.getY()+confData.invadersSize >= pm.getScreenWidth() || if (invaderPos.getY() + confData.invadersSize >= pm.getScreenWidth() ||
(invaderPos.getX() < 0 || invaderPos.getX() + confData.invadersSize >= pm.getScreenWidth())) { (invaderPos.getX() < 0 || invaderPos.getX() + confData.invadersSize >= pm.getScreenWidth())) {
touched = true; touched = true;
// check player collision // check player collision
} else if (invaderPos.getY() + confData.invadersSize >= pm.getScreenHeight() - PLAYER_HEIGHT) { } else if (invaderPos.getY() + confData.invadersSize >= pm.getScreenHeight() - PLAYER_HEIGHT) {
for (Player& p: players) { for (Player &p: players) {
if (areLinesColliding( if (areLinesColliding(
p.x, p.x + confData.playersWidth, p.x, p.x + confData.playersWidth,
invaderPos.getX(), invaderPos.getX() + confData.invadersSize invaderPos.getX(), invaderPos.getX() + confData.invadersSize
@ -105,7 +105,7 @@ bool Game::manageGod() {
} }
} }
} }
if (touched){ if (touched) {
god.state = GodState::WAIT; god.state = GodState::WAIT;
god.counter = 0; god.counter = 0;
} }
@ -113,8 +113,11 @@ bool Game::manageGod() {
* we do not need to reset other members, they'll be treated as non-initialized * we do not need to reset other members, they'll be treated as non-initialized
* When we cycle back between states * When we cycle back between states
*/ */
}
return false; return false;
}
case GodState::YOLO: {
}
} }
} }