Add rest of assets, add blue player

This commit is contained in:
2024-01-23 11:26:23 +01:00
parent ac7525c42a
commit c9a2bd2672
45 changed files with 6647 additions and 39 deletions

View File

@@ -28,13 +28,13 @@ void updateAnimationState(ecs_iter_t *it) {
}
}
void updateAnimation(ecs_iter_t *it) {
Game *game = ecs_singleton_get_mut(ECS, Game);
Animation *anim = ecs_field(it, Animation, 1);
TextureRegion *texture = ecs_field(it, TextureRegion, 2);
float dt = GetFrameTime();
for (i32 i = 0; i < it->count; i++) {
ecs_entity_t entity = it->entities[i];
AnimationFrame frame = anim[i].frame;
AnimationSequence seq = anim[i].sequence;
@@ -46,7 +46,14 @@ void updateAnimation(ecs_iter_t *it) {
anim[i].frame = entityGetAnimationFrame(anim[i].entityType, anim[i].animType, nextFrame);
anim[i].elapsed = 0.0f;
texture[i].rec = bzTilesetGetTileRegion(anim[i].tileset, anim[i].frame.frame);
texture[i].rec = getTextureRect(anim[i].frame.frame);
if (ecs_has(ECS, entity, Owner)) {
Owner owner = *ecs_get(ECS, entity, Owner);
BzTileID base = anim[i].frame.frame;
Vector2 offset = getTileOffset(base, owner.player);
texture[i].rec.x += offset.x;
texture[i].rec.y += offset.y;
}
}
}