Add texture flipping
This commit is contained in:
@@ -86,6 +86,13 @@ void entityUpdateKinematic(ecs_iter_t *it) {
|
|||||||
position[i].x += velocity[i].x * dt * 10;
|
position[i].x += velocity[i].x * dt * 10;
|
||||||
position[i].y += velocity[i].y * dt * 10;
|
position[i].y += velocity[i].y * dt * 10;
|
||||||
rotation[i] += angularVelocity[i] * dt * 10;
|
rotation[i] += angularVelocity[i] * dt * 10;
|
||||||
|
|
||||||
|
// Update flipX
|
||||||
|
ecs_entity_t entity = it->entities[i];
|
||||||
|
if (ecs_has(it->world, entity, TextureRegion)) {
|
||||||
|
TextureRegion *text = ecs_get_mut(it->world, entity, TextureRegion);
|
||||||
|
text->flipX = velocity[i].x < 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user