Very basic animations
This commit is contained in:
@@ -22,6 +22,7 @@ bool initEntityObjectsLayer(BzTileMap *map, BzTileObjectGroup *objectGroup) {
|
||||
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;
|
||||
@@ -33,6 +34,16 @@ bool initEntityObjectsLayer(BzTileMap *map, BzTileObjectGroup *objectGroup) {
|
||||
ecs_set(ECS, e, Size, {object.shape.sizeX, object.shape.sizeY});
|
||||
ecs_set(ECS, e, Rotation, {0.0f});
|
||||
ecs_set(ECS, e, TextureRegion, {objectTileset->tiles, bzTilesetGetTileRegion(objectTileset, object.gid)});
|
||||
ecs_set(ECS, e, Animation, {
|
||||
.firstFrame=(TextureRegion) {
|
||||
objectTileset->tiles,
|
||||
bzTilesetGetTileRegion(objectTileset, object.gid)
|
||||
},
|
||||
.currAnimation=ANIMATION_IDLE,
|
||||
.currFrame=0,
|
||||
.frameCount=2,
|
||||
.frameDuration=0.36f
|
||||
});
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user