small changes
parent
235acfa122
commit
6a8e5286ea
|
@ -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
|
// 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(), General);
|
||||||
ECS_IMPORT(world_ecs(), Controllers);
|
ECS_IMPORT(world_ecs(), Controllers);
|
||||||
ECS_IMPORT(world_ecs(), Physics);
|
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;
|
uint16_t half_world_dim = world_dim() / 2;
|
||||||
pos->x=rand() % world_dim() - half_world_dim;
|
for (int i = 0; i < 100; i++) {
|
||||||
pos->y=rand() % world_dim() - half_world_dim;
|
uint64_t e = entity_spawn(NULL);
|
||||||
|
ecs_add(world_ecs(), e, EcsDemoNPC);
|
||||||
Velocity *v = ecs_get_mut(world_ecs(), e, Velocity, NULL);
|
Position *pos = ecs_get_mut(world_ecs(), e, Position, NULL);
|
||||||
v->x = (rand()%3-1) * 100;
|
pos->x=rand() % world_dim() - half_world_dim;
|
||||||
v->y = (rand()%3-1) * 100;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue