crocparty/game/game.c

58 lines
1.0 KiB
C
Raw Normal View History

2024-02-27 23:57:37 +00:00
#include "art/game_player.h"
2024-02-27 23:09:51 +00:00
#include "art/game_tiles.h"
2024-02-26 00:40:33 +00:00
#include "device/device.h"
2024-02-27 04:19:22 +00:00
#include "map/game_map.h"
2024-02-25 03:00:23 +00:00
#include "game.h"
#include "sys/sys.h"
2024-02-28 03:57:37 +00:00
#include <stdio.h>
2024-02-25 03:00:23 +00:00
uint32_t game_frame;
const char* game_title() {
return "Croc Party!";
}
2024-02-25 03:00:23 +00:00
void game_init() {
sys_init();
2024-02-28 21:14:48 +00:00
map_game_map_create_entities();
2024-02-27 23:57:37 +00:00
game_palette_init();
2024-02-28 05:07:15 +00:00
game_player_init();
}
void game_destroy() {
sys_destroy();
2024-02-25 03:00:23 +00:00
}
void game_update() {
2024-02-28 05:07:15 +00:00
sys_update();
2024-02-28 03:57:37 +00:00
2024-02-28 05:07:15 +00:00
game_frame += 1;
2024-02-29 04:48:22 +00:00
bool allow_input = true;
2024-02-29 00:10:09 +00:00
game_collectibles_update();
2024-02-29 04:48:22 +00:00
game_dialogue_update(&allow_input);
2024-02-29 22:31:44 +00:00
game_inflict_update(&allow_input);
2024-02-29 05:07:17 +00:00
game_npcs_update(&allow_input);
2024-02-29 04:48:22 +00:00
game_player_update(&allow_input);
2024-02-25 03:00:23 +00:00
}
void game_draw() {
2024-02-27 23:57:37 +00:00
sys_cls(9);
2024-02-28 20:54:59 +00:00
game_player_set_camera();
sys_map_draw(map_game_map, spr_game_tiles, 0, 0, 0, 0, map_game_map.width, map_game_map.height);
2024-02-29 00:10:09 +00:00
game_collectibles_draw();
2024-02-29 03:42:03 +00:00
game_npcs_draw();
2024-02-28 05:07:15 +00:00
game_player_draw();
2024-02-28 20:54:59 +00:00
sys_camera_reset();
2024-02-29 04:48:22 +00:00
2024-02-29 20:08:50 +00:00
game_player_draw_hud();
2024-02-29 22:31:44 +00:00
game_inflict_draw();
game_dialogue_draw();
2024-02-25 03:00:23 +00:00
}