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