Fix gameover menu and change base health from 150 hp to 200

# To do:
- Dasagne
- Better rules
This commit is contained in:
2024-05-23 14:48:17 +02:00
parent 93f1a2bc0d
commit b82c1d12d7
3 changed files with 11 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ Game::Game(Menu* menu) : menu(menu)
gameMap = new Map(this);
// Create the player object
player = new Player(150, 0, 10, 10, 1, ":/ressources/player.png", 0, 0, *gameMap, *this);
player = new Player(200, 0, 10, 10, 1, ":/ressources/player.png", 0, 0, *gameMap, *this);
// Create the text items for the health, gold and wave number
healthDisplay = new QGraphicsTextItem();
@@ -65,7 +65,7 @@ Game::Game(Menu* menu) : menu(menu)
void Game::start() {
// Heal the player to full health (150)
int preiousHealth = player->getHealth();
player->heal(150 - preiousHealth);
player->heal(200 - preiousHealth);
// Create the map
gameMap->generateMap(25, 14, this);
@@ -275,7 +275,7 @@ void Game::gameOver() {
auto* gameOver = new Gameover(this);
connect(gameOver, &Gameover::restartGameSignal, this, &Game::start);
gameOver->setFixedSize(200, 100);
gameOver->setFixedSize(200, 170);
gameOver->show();
}

View File

@@ -5,17 +5,22 @@
#include "Gameover.h"
Gameover::Gameover(Game* game, QWidget *parent) : QWidget(parent), game(game) {
this->setStyleSheet("background-color: #071A22; color: #9EB1BD;");
restartButton = new QPushButton("Restart", this);
quitButton = new QPushButton("Quit", this);
restartButton->setFixedSize(100, 50);
quitButton->setFixedSize(100, 50);
restartButton->setStyleSheet("background-color: #0A385A; color: #9EB1BD; font-size: 40px; font-weight: bold;");
quitButton->setStyleSheet("background-color: #0A385A; color: #9EB1BD; font-size: 40px; font-weight: bold;");
connect(restartButton, &QPushButton::clicked, this, &Gameover::onRestartButtonClicked);
connect(quitButton, &QPushButton::clicked, this, &Gameover::onQuitButtonClicked);
restartButton->setFixedHeight(53);
quitButton->setFixedHeight(53);
auto *buttonLayout = new QVBoxLayout();
buttonLayout->addWidget(restartButton);
buttonLayout->addSpacing(53);
buttonLayout->addWidget(quitButton);
auto* mainLayout = new QGridLayout(this);

View File

@@ -7,6 +7,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
this->setCentralWidget(menu);
this->setWindowTitle("Poulpes de l'espace: La dernière ligne de défense");
//this->setFixedSize(1320, 760);
this->resize(1320, 760);
helpMenu = menuBar()->addMenu(tr("&Help"));
QAction* actionHelp = new QAction(tr("&About"), this);