Multiple stages

This commit is contained in:
Juhani Krekelä 2022-01-15 16:23:37 +00:00
parent cfc00470f6
commit 67572c9a69
1 changed files with 31 additions and 12 deletions

View File

@ -42,16 +42,29 @@ static enum palette playfield[PLAYFIELD_SIDE * PLAYFIELD_SIDE];
#include "stage2_tile.inc"
#include "star_tile.inc"
static char tilemap[] = " "
" "
" "
"! g "
"gg g "
" g"
" g "
" g "
"@ gdg "
"gg dddgg ";
static char tilemap[TILES * TILES + 1];
static char *stages[] = {
" "
" "
" "
"! g "
"gg g "
" g"
" g "
" g "
"@ gdg "
"gg dddgg ",
" "
" "
" "
" "
" "
" "
" "
" "
" !"
"gggggggggg"
};
static uint32_t main_window = 0;
static uint32_t window_width = 600;
@ -123,7 +136,10 @@ static double in_jump;
static double player_x, player_y;
static double player_dx, player_dy;
static size_t selection_index = 0;
static void initialize_stage(void) {
strcpy(tilemap, stages[selection_index]);
jumping = false;
on_ground = false;
player_dx = 0;
@ -139,13 +155,16 @@ static void initialize_stage(void) {
}
}
static size_t selection_index = 0;
static bool keys_released;
static bool stage_selected;
static void initialize_titlescreen(void) {
keys_released = false; stage_selected = false;
}
static void initialize(void) {
switch (game_mode) {
case TITLESCREEN: keys_released = false; stage_selected = false; break;
case TITLESCREEN: initialize_titlescreen(); break;
case STAGE: initialize_stage(); break;
default: printf("%i\n", game_mode); break;
}