diff options
| author | Patrick Schönberger | 2020-09-26 12:28:27 +0200 |
|---|---|---|
| committer | Patrick Schönberger | 2020-09-26 12:28:27 +0200 |
| commit | 614283195b67ef0aa4f9d1ecd1ad2791c36c8fda (patch) | |
| tree | b29569d124609fdda229e2ead6b1e427514cf3f9 /src | |
| parent | e1f391822f6d5c036c688fb17c60f66eab253ae1 (diff) | |
| download | npengine-614283195b67ef0aa4f9d1ecd1ad2791c36c8fda.tar.gz npengine-614283195b67ef0aa4f9d1ecd1ad2791c36c8fda.zip | |
movement done
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5b98797..b762f69 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -209,10 +209,6 @@ void print_text(int text_x, int text_y, const char *text, int delay) { Sleep(100);
}
-enum GameState {
- GS_START, GS_INTRO1, GS_INTRO2
-};
-
void update_play(bool can_jump = true) {
if (get_dur(update_clock) >= update_time) {
update_clock = clock();
@@ -269,10 +265,12 @@ void update_play(bool can_jump = true) { }
}
-enum GameState game_state = GS_START;
-void update_game() {
- switch (game_state) {
- case GS_START:
+int lvl = 0;
+
+void intro() {
+ static int progress = 0;
+ switch (progress) {
+ case 0:
press(VK_DOWN);
press(VK_RIGHT);
press(VK_RIGHT);
@@ -281,21 +279,29 @@ void update_game() { print_text(4, 2, "Move with left/right.", 30);
- game_state = GS_INTRO1;
+ progress++;
break;
- case GS_INTRO1:
+ case 1:
update_play(false);
if (x == 5) {
print_text(4, 4, "Jump with up.", 30);
- game_state = GS_INTRO2;
+ progress++;
}
break;
- case GS_INTRO2:
+ case 2:
update_play();
break;
}
}
+void update_game() {
+ switch (lvl) {
+ case 0:
+ intro();
+ break;
+ }
+}
+
/*
Todo:
- Restart
|
