Path following

This commit is contained in:
2023-11-14 12:01:28 +01:00
parent ab817ee03d
commit 8825b9e01f
14 changed files with 213 additions and 102 deletions

View File

@@ -18,18 +18,13 @@ bool initGameObjectsLayer(BzTileMap *map, BzTileObjectGroup *objectGroup) {
}
bool initEntityObjectsLayer(BzTileMap *map, BzTileObjectGroup *objectGroup) {
ECS_COMPONENT(ECS, Position);
ECS_COMPONENT(ECS, Size);
ECS_COMPONENT(ECS, Rotation);
ECS_COMPONENT(ECS, TextureRegion);
ECS_COMPONENT(ECS, Animation);
BzTileset *objectTileset = bzTileObjectGroupGetTileset(&GAME->map, objectGroup);
if (!objectTileset) return true;
for (i32 i = 0; i < objectGroup->objectCount; i++) {
BzTileObject object = objectGroup->objects[i];
ecs_entity_t e = ecs_new_id(ECS);
GAME->entity = e;
ecs_set(ECS, e, Position, {object.shape.x, object.shape.y});
ecs_set(ECS, e, Size, {object.shape.sizeX, object.shape.sizeY});
ecs_set(ECS, e, Rotation, {0.0f});
@@ -50,10 +45,6 @@ bool initEntityObjectsLayer(BzTileMap *map, BzTileObjectGroup *objectGroup) {
}
bool initBuildingsLayer(BzTileMap *map, BzTileLayer *layer) {
ECS_COMPONENT(ECS, TilePosition);
ECS_COMPONENT(ECS, TileSize);
ECS_COMPONENT(ECS, Owner);
GAME->entityMap = bzCalloc(sizeof(*GAME->entityMap), layer->width * layer->height);
BzTileLayer *ownershipLayer = layer;