Fixed god. Last commit, I'm not going to do more
This commit is contained in:
parent
82bb693915
commit
8b25c55cbc
@ -68,7 +68,7 @@ players:
|
|||||||
startXPosition: 600
|
startXPosition: 600
|
||||||
fireCooldown: 10
|
fireCooldown: 10
|
||||||
speed: 10
|
speed: 10
|
||||||
lives: 100
|
lives: 3
|
||||||
user1:
|
user1:
|
||||||
color: red
|
color: red
|
||||||
keys:
|
keys:
|
||||||
|
@ -27,7 +27,6 @@ enum class GodState{
|
|||||||
RETRIEVE1,
|
RETRIEVE1,
|
||||||
RETRIEVE2,
|
RETRIEVE2,
|
||||||
THROW,
|
THROW,
|
||||||
YOLO,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ public:
|
|||||||
* @param[in] pos : pixel coordinates to draw the sprite
|
* @param[in] pos : pixel coordinates to draw the sprite
|
||||||
* @fn void drawSprite(const MySprite& msp, const Position& pos = Position(0, 0)) const;
|
* @fn void drawSprite(const MySprite& msp, const Position& pos = Position(0, 0)) const;
|
||||||
*/
|
*/
|
||||||
void drawSprite(const MySprite& msp, const Position& pos = Position(0, 0)) const;
|
void drawSprite(const MySprite& msp, const Position& pos) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief display a menu button on screen
|
* @brief display a menu button on screen
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* The more important stuff must be drawn last
|
* The more important stuff must be drawn last
|
||||||
*/
|
*/
|
||||||
void Game::displayAll(unsigned fps) const {
|
void Game::displayAll(unsigned fps) const {
|
||||||
pm->drawSprite(pm->gameBackground);
|
pm->drawSprite(pm->gameBackground, Position(0, 0));
|
||||||
for (unsigned i = 0; i < this->grid.size(); ++i){
|
for (unsigned i = 0; i < this->grid.size(); ++i){
|
||||||
for (unsigned j = 0; j < this->grid[i].size(); ++j){
|
for (unsigned j = 0; j < this->grid[i].size(); ++j){
|
||||||
Position vec(
|
Position vec(
|
||||||
@ -113,8 +113,8 @@ void Game::displayGod() const {
|
|||||||
|
|
||||||
Position leftHand(GOD_HAND_DISTANCE, god.counter-GOD_BENCH_SIZE);
|
Position leftHand(GOD_HAND_DISTANCE, god.counter-GOD_BENCH_SIZE);
|
||||||
Position rightHand(pm->getScreenWidth()-GOD_HAND_DISTANCE-GOD_HAND_SIZE, god.counter-GOD_BENCH_SIZE);
|
Position rightHand(pm->getScreenWidth()-GOD_HAND_DISTANCE-GOD_HAND_SIZE, god.counter-GOD_BENCH_SIZE);
|
||||||
pm->drawSprite(pm->leftHand);
|
pm->drawSprite(pm->leftHand, leftHand);
|
||||||
pm->drawSprite(pm->rightHand);
|
pm->drawSprite(pm->rightHand, rightHand);
|
||||||
pm->drawGodFace(god.counter - GOD_BENCH_SIZE);
|
pm->drawGodFace(god.counter - GOD_BENCH_SIZE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -122,8 +122,8 @@ void Game::displayGod() const {
|
|||||||
pm->drawGodBench(0);
|
pm->drawGodBench(0);
|
||||||
Position leftHand(GOD_HAND_DISTANCE, 0);
|
Position leftHand(GOD_HAND_DISTANCE, 0);
|
||||||
Position rightHand(god.getRightHandPos(pm->getScreenWidth()));
|
Position rightHand(god.getRightHandPos(pm->getScreenWidth()));
|
||||||
pm->drawSprite(pm->leftHand);
|
pm->drawSprite(pm->leftHand, leftHand);
|
||||||
pm->drawSprite(pm->rightHand);
|
pm->drawSprite(pm->rightHand, rightHand);
|
||||||
pm->drawGodFace(0);
|
pm->drawGodFace(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ void Game::displayGod() const {
|
|||||||
else handCounter = 30-god.counter;
|
else handCounter = 30-god.counter;
|
||||||
handPos = handPos + god.thrownVector * (handCounter / 100.0);
|
handPos = handPos + god.thrownVector * (handCounter / 100.0);
|
||||||
}
|
}
|
||||||
pm->drawSprite(pm->rightHand);
|
pm->drawSprite(pm->rightHand, handPos);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,6 @@ bool Game::manageGod() {
|
|||||||
if (touched) {
|
if (touched) {
|
||||||
god.state = GodState::WAIT;
|
god.state = GodState::WAIT;
|
||||||
god.counter = 0;
|
god.counter = 0;
|
||||||
if(!areThereInvadersLeft())return true;
|
|
||||||
}
|
}
|
||||||
/* 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*/
|
||||||
@ -143,9 +142,7 @@ bool Game::manageGod() {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case GodState::YOLO: {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw runtime_error("SHOULD NOT HAPPEN : invalid action for god : ID="+ to_string(static_cast<int>(god.state)));
|
throw runtime_error("SHOULD NOT HAPPEN : invalid action for god : ID="+ to_string(static_cast<int>(god.state)));
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ void PixelManager::displayButton(const Position& baseVector, const string& text,
|
|||||||
|
|
||||||
void PixelManager::displayMenu(const Position& pos, Menu& currentMenu){
|
void PixelManager::displayMenu(const Position& pos, Menu& currentMenu){
|
||||||
startFrame();
|
startFrame();
|
||||||
drawSprite(menuBackground);
|
drawSprite(menuBackground, Position(0, 0));
|
||||||
drawSprite(logo,Position(100,50));
|
drawSprite(logo,Position(100,50));
|
||||||
drawText(Position(1150, 700), "version 1.0.0");
|
drawText(Position(1150, 700), "version 1.0.0");
|
||||||
unsigned margin = 0;
|
unsigned margin = 0;
|
||||||
@ -43,7 +43,7 @@ void PixelManager::displayMenu(const Position& pos, Menu& currentMenu){
|
|||||||
|
|
||||||
void PixelManager::displayMenu(const Position& pos, Menu& currentMenu, const vector<ScoreLink>& rankings){
|
void PixelManager::displayMenu(const Position& pos, Menu& currentMenu, const vector<ScoreLink>& rankings){
|
||||||
startFrame();
|
startFrame();
|
||||||
drawSprite(menuBackground);
|
drawSprite(menuBackground, Position(0, 0));
|
||||||
drawSprite(logo,Position(100,50));
|
drawSprite(logo,Position(100,50));
|
||||||
drawText(Position(1150, 700), "version 1.0.0");
|
drawText(Position(1150, 700), "version 1.0.0");
|
||||||
unsigned margin = 0;
|
unsigned margin = 0;
|
||||||
@ -105,7 +105,7 @@ void PixelManager::askPlayerNameMenu(playerID pID, unsigned score, string& name)
|
|||||||
chrono::milliseconds waitTime = chrono::milliseconds(100);
|
chrono::milliseconds waitTime = chrono::milliseconds(100);
|
||||||
while (window.isOpen()){
|
while (window.isOpen()){
|
||||||
startFrame();
|
startFrame();
|
||||||
drawSprite(menuBackground);
|
drawSprite(menuBackground, Position(0, 0));
|
||||||
drawText(Position(600, 100), "Nom du joueur " + to_string(pID + 1));
|
drawText(Position(600, 100), "Nom du joueur " + to_string(pID + 1));
|
||||||
drawText(Position(600, 150), "Score : " + to_string(score));
|
drawText(Position(600, 150), "Score : " + to_string(score));
|
||||||
for (unsigned i = 0; i < name.size(); ++i){
|
for (unsigned i = 0; i < name.size(); ++i){
|
||||||
|
Loading…
Reference in New Issue
Block a user