diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-04 21:17:23 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-04 21:17:23 +0100 |
commit | c9f83a504dc1566543a01dac955d368f8e9ace08 (patch) | |
tree | e301466a4f58acb90094507522802c3034f0863b /src/main.cpp | |
parent | add readme and optimize shooting vectors (diff) | |
download | threshold-c9f83a504dc1566543a01dac955d368f8e9ace08.tar.gz threshold-c9f83a504dc1566543a01dac955d368f8e9ace08.tar.bz2 threshold-c9f83a504dc1566543a01dac955d368f8e9ace08.tar.xz threshold-c9f83a504dc1566543a01dac955d368f8e9ace08.tar.zst threshold-c9f83a504dc1566543a01dac955d368f8e9ace08.zip |
two levels. moved shooting logic elsewhere
Diffstat (limited to '')
-rw-r--r-- | src/main.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 74b1adf..3136318 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,13 +35,31 @@ int main(void) { { break ; } + case (NEXT): + { + if (IsKeyPressed(KEY_ENTER)) + { + gs = TITLE; + std::string next("../meta/maps/"); + next += game->getNext(); + + delete game; + if (next != "0") { + game = new Game(next); + } + } + break ; + } case (ENDING): { if (IsKeyPressed(KEY_ENTER)) { gs = TITLE; + auto next = game->getNext(); delete game; - game = new Game("../meta/maps/stage_1_start.bfm"); + if (next != "0") { + game = new Game("../meta/maps/stage_1_start.bfm"); + } } break ; } @@ -59,12 +77,19 @@ int main(void) { } case (GAMEPLAY): { - if (game->getKeys()) { - gs = ENDING; + if (auto code = game->getKeys()) { + if (code == 1) + gs = ENDING; + else if (code == 2) + gs = NEXT; } game->draw(); break ; } + case (NEXT): + { + break ; + } case (ENDING): { DrawCircle(SCREENWIDTH / 2, SCREENHEIGHT / 2, 200, BLACK); |