Spawn a new food when one was eaten. Initially, there's one food per player spawned.

This commit is contained in:
2025-12-18 13:50:27 +01:00
parent 49732d8b27
commit 5e6b042921
4 changed files with 38 additions and 30 deletions

View File

@@ -19,7 +19,7 @@ typedef struct {
} Game_World;
Game_World *game_world_create(uint32_t seed, uint16_t level_width, uint16_t level_height);
Game_World *game_world_create(uint32_t seed, uint8_t amount_of_food_to_spawn_initially, uint16_t level_width, uint16_t level_height);
void game_world_destroy(Game_World *world);
bool game_world_create_entity(Game_World *world, Entity_Type type, uint16_t x, uint16_t y, Entity_ID *out_entity_id);
@@ -31,8 +31,6 @@ void game_world_tick(Game_World *world);
Entity *game_world_try_get_entity_by_id(Game_World *world, Entity_ID id);
#define MAX_ATTEMPTS_AT_FINDING_POSITION_TO_SPAWN 8
bool game_world_find_position_to_spawn(Game_World *world, uint16_t *out_x, uint16_t *out_y);
Entity_Movement_Direction game_world_choose_initial_move_direction_based_on_coords(Game_World *world, uint16_t x, uint16_t y);