From 91aef268319a77ee8f5a082ca89264bf2671e212 Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 6 May 2023 10:39:19 +1000 Subject: Map rendering and camera movement. --- game.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'game.c') diff --git a/game.c b/game.c index 73d062b..00e4265 100644 --- a/game.c +++ b/game.c @@ -87,18 +87,22 @@ static void menu_deinit(Game* game) { static void gameplay_init(Game* game) { init_world(&game->world); - + init_map(&game->world.map); init_player(&game->world.player, &game->world); - new_skull(&game->world, 0, 0); } static void gameplay_update(Game* game) { + int cx, cy; + cx = game->world.cam_x; + cy = game->world.cam_y; + update_player(&game->world.player, &game->world); enemy_system(&game->world); bullet_system(&game->world); collision_system(&game->world); animation_system(&game->world); + render_map(&game->world.map, cx, cy); sprite_system(&game->world); } @@ -127,11 +131,15 @@ static void dead_init(Game* game) { static void dead_update(Game* game) { const BM_Font* font; + int cx, cy; font = get_default_font(); update_menu(&game->menu); + cx = game->world.cam_x; + cy = game->world.cam_y; + render_map(&game->world.map, cx, cy); sprite_system(&game->world); rfont_text( -- cgit v1.2.3-54-g00ecf