Multiple stages
This commit is contained in:
parent
cfc00470f6
commit
67572c9a69
27
platformer.c
27
platformer.c
|
@ -42,7 +42,9 @@ static enum palette playfield[PLAYFIELD_SIDE * PLAYFIELD_SIDE];
|
|||
#include "stage2_tile.inc"
|
||||
#include "star_tile.inc"
|
||||
|
||||
static char tilemap[] = " "
|
||||
static char tilemap[TILES * TILES + 1];
|
||||
static char *stages[] = {
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
"! g "
|
||||
|
@ -51,7 +53,18 @@ static char tilemap[] = " "
|
|||
" g "
|
||||
" g "
|
||||
"@ gdg "
|
||||
"gg dddgg ";
|
||||
"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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue