aboutsummaryrefslogtreecommitdiff
path: root/game.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-06 10:39:19 +1000
committerquou <quou@disroot.org>2023-05-06 10:39:19 +1000
commit91aef268319a77ee8f5a082ca89264bf2671e212 (patch)
tree7deb9a4a9e928d4b78f7c3398e7d9c97a4649140 /game.c
parent2ab411c4b8855d11d48454a93262e8eae3ba7fc7 (diff)
Map rendering and camera movement.
Diffstat (limited to 'game.c')
-rw-r--r--game.c12
1 files changed, 10 insertions, 2 deletions
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(