From 6a8e5286eab0aca8e4a3c0c71e6a1f98f3e83b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Sat, 8 May 2021 11:06:53 +0200 Subject: [PATCH] small changes --- code/apps/client/source/game.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/code/apps/client/source/game.c b/code/apps/client/source/game.c index 9f2acb2..a4e4407 100644 --- a/code/apps/client/source/game.c +++ b/code/apps/client/source/game.c @@ -122,20 +122,22 @@ void game_init(int8_t play_mode, uint32_t num_viewers, int32_t seed, uint16_t bl } // TODO(zaklaus): VERY TEMPORARY -- SPAWN SOME NPCS THAT RANDOMLY MOVE - for (int i = 0; i < 100; i++) { + { ECS_IMPORT(world_ecs(), General); ECS_IMPORT(world_ecs(), Controllers); ECS_IMPORT(world_ecs(), Physics); - uint64_t e = entity_spawn(NULL); - ecs_add(world_ecs(), e, EcsDemoNPC); - Position *pos = ecs_get_mut(world_ecs(), e, Position, NULL); uint16_t half_world_dim = world_dim() / 2; - pos->x=rand() % world_dim() - half_world_dim; - pos->y=rand() % world_dim() - half_world_dim; - - Velocity *v = ecs_get_mut(world_ecs(), e, Velocity, NULL); - v->x = (rand()%3-1) * 100; - v->y = (rand()%3-1) * 100; + for (int i = 0; i < 100; i++) { + uint64_t e = entity_spawn(NULL); + ecs_add(world_ecs(), e, EcsDemoNPC); + Position *pos = ecs_get_mut(world_ecs(), e, Position, NULL); + pos->x=rand() % world_dim() - half_world_dim; + pos->y=rand() % world_dim() - half_world_dim; + + Velocity *v = ecs_get_mut(world_ecs(), e, Velocity, NULL); + v->x = (rand()%3-1) * 100; + v->y = (rand()%3-1) * 100; + } } }