added positioning

This commit is contained in:
Priec
2025-11-14 16:42:16 +01:00
parent f6a13309f7
commit d8da84cffc
3 changed files with 14 additions and 17 deletions

View File

@@ -25,6 +25,11 @@ struct WalkingState {
Timer state_timer;
};
struct PlayerPosition {
int x;
int y;
};
static char rx_buffer[BUFFER_SIZE];
static char message[BUFFER_SIZE];
static bool message_active = false;
@@ -128,6 +133,8 @@ void render_loop(int speed) {
anim_timer.start();
int shift = 0;
PlayerPosition pos = {9, 3};
const char *bg_file = "background_dark_inverted.txt";
bool need_redraw = false;
@@ -155,7 +162,7 @@ void render_loop(int speed) {
if (need_redraw) {
draw_mask(bg_file, shift, message_active ? message : nullptr);
int player_frame = get_player_frame(player_state.current_state);
draw_player(PLAYER_X, PLAYER_Y, player_frame);
draw_player(pos.x, pos.y, player_frame);
// alternate between frame 0 and 1 when not crawling
if (player_state.current_state != PlayerState::Crawl1) {