added ZEN gamemode

This commit is contained in:
2025-03-27 21:50:36 +01:00
parent 88cb44c5fe
commit 3d74ef7cd5
5 changed files with 19 additions and 10 deletions

View File

@@ -24,8 +24,8 @@ If you want to know more details about the generation and classification of poly
- MARATHON : clear 200 lines with increasing gravity!
- ULTRA : scores as much as possible in only 2 minutes!
- MASTER : clear 200 lines at levels higher than maximum gravity!
- ??? : ???
- ??? : ???
- ZEN : practice indefinitely in this mode with no gravity!
- ??? : still to do
## Manual build
@@ -56,5 +56,5 @@ If for some reasons you wanna run the command line version:
Library used: [SFML 3](https://www.sfml-dev.org/).
Font used: [Press Start](https://www.zone38.net/font/#pressstart).
Inspired by other stacker games such as Techmino, jstris, tetr.io, etc.
Inspired by other modern stacker games such as Techmino, jstris, tetr.io, etc.
This game isn't affiliated with any of them.

View File

@@ -22,6 +22,8 @@ void GameParameters::reset() {
case MARATHON : {this->level = 1; break;}
// goes from level 20 to 39
case MASTER : {this->level = 20; break;}
// no gravity
case ZEN : {this->level = 0; break;}
default : this->level = 1;
}
@@ -58,6 +60,8 @@ bool GameParameters::hasWon(int framesPassed) const {
case MARATHON : return this->clearedLines >= 200;
// win once 200 lines have been cleared
case MASTER : return this->clearedLines >= 200;
// infinite mode
case ZEN :
default : return false;
}
}
@@ -65,13 +69,14 @@ bool GameParameters::hasWon(int framesPassed) const {
void GameParameters::updateStats() {
/* NEXT QUEUE */
switch (this->gamemode) {
// 5 for rapidity gamemodes
// 5 for fast-controls gamemodes
case SPRINT :
case ULTRA : {
case ULTRA :
case ZEN : {
this->nextQueueLength = 5;
break;
}
// 3 for endurance gamemodes
// 3 for slow-controls gamemodes
case MARATHON :
case MASTER : {
this->nextQueueLength = 3;
@@ -126,6 +131,8 @@ void GameParameters::updateStats() {
switch (this->gamemode) {
// starts at 500ms (30f) at lvl 20 and ends at 183ms (11f) at lvl 39
case MASTER : {this->lockDelay = 30 - (this->level - 20); break;}
// 10s
case ZEN : {this->lockDelay = 60 * 10; break;}
// 1s by default
default : this->lockDelay = 60;
}

View File

@@ -8,5 +8,6 @@ enum Gamemode {
SPRINT,
MARATHON,
ULTRA,
MASTER
MASTER,
ZEN
};

View File

@@ -12,7 +12,7 @@
GameSettingsAppMenu::GameSettingsAppMenu(std::shared_ptr<MenuStack> menuStack, std::shared_ptr<Settings> settings, std::shared_ptr<sf::RenderWindow> renderWindow) :
AppMenu(menuStack, settings, renderWindow),
playerCursor(std::vector<unsigned int>({2, 3, 1})) {
playerCursor(std::vector<unsigned int>({2, 3, 2})) {
}
@@ -32,7 +32,7 @@ void GameSettingsAppMenu::computeFrame() {
case 2 : {
switch (this->playerCursor.getPosition().x) {
case 0 : {this->settings->setGamemode(MASTER); break;}
case 1 : break; //TODO
case 1 : {this->settings->setGamemode(ZEN); break;}
case 2 : break; //TODO
}
break;
@@ -68,7 +68,7 @@ void GameSettingsAppMenu::drawFrame() const {
this->placeText(text, this->playerCursor, "MARATHON", 25.f, 25.f, sf::Vector2u{1, 1});
this->placeText(text, this->playerCursor, "ULTRA", 50.f, 25.f, sf::Vector2u{2, 1});
this->placeText(text, this->playerCursor, "MASTER", 5.f, 35.f, sf::Vector2u{0, 2});
this->placeText(text, this->playerCursor, "??? (TODO)", 25.f, 35.f, sf::Vector2u{1, 2});
this->placeText(text, this->playerCursor, "ZEN", 25.f, 35.f, sf::Vector2u{1, 2});
this->placeText(text, this->playerCursor, "??? (TODO)", 50.f, 35.f, sf::Vector2u{2, 2});
this->renderWindow->display();

View File

@@ -1,6 +1,7 @@
#include "GraphApp.h"
#include "../Pieces/PiecesFiles.h"
#include <filesystem>
#include <fstream>