Fix rotation
This commit is contained in:
@@ -129,10 +129,10 @@ static ParticleEmitter GET_BLOOD_EMITTER() {
|
|||||||
.data.maxStartSize = 3.3f,
|
.data.maxStartSize = 3.3f,
|
||||||
.data.minEndSize = 0.8f,
|
.data.minEndSize = 0.8f,
|
||||||
.data.maxEndSize = 1.1f,
|
.data.maxEndSize = 1.1f,
|
||||||
.data.minStartRotSpeed = 8.0f,
|
.data.minStartRotSpeed = 0.0f,
|
||||||
.data.maxStartRotSpeed = 14.0f,
|
.data.maxStartRotSpeed = 360.0f,
|
||||||
.data.minEndRotSpeed = 4.5f,
|
.data.minEndRotSpeed = 400.5f,
|
||||||
.data.maxEndRotSpeed = 6.2f,
|
.data.maxEndRotSpeed = 600.2f,
|
||||||
.data.startColor = { 210, 0, 0, 255 },
|
.data.startColor = { 210, 0, 0, 255 },
|
||||||
.data.endColor = { 110, 10, 10, 32 },
|
.data.endColor = { 110, 10, 10, 32 },
|
||||||
.data.minLifetime = 0.23,
|
.data.minLifetime = 0.23,
|
||||||
|
|||||||
@@ -535,7 +535,6 @@ static void renderGame(Game *game, float dt) {
|
|||||||
while (ecs_iter_next(&it)) {
|
while (ecs_iter_next(&it)) {
|
||||||
Particle *particle = ecs_field(&it, ParticleLayer0, 1);
|
Particle *particle = ecs_field(&it, ParticleLayer0, 1);
|
||||||
for (i32 i = 0; i < it.count; i++) {
|
for (i32 i = 0; i < it.count; i++) {
|
||||||
bzLogInfo("what");
|
|
||||||
if (updateParticle(tex, &particle[i], dt))
|
if (updateParticle(tex, &particle[i], dt))
|
||||||
ecs_delete(ECS, it.entities[i]);
|
ecs_delete(ECS, it.entities[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ bool updateParticle(const Texture2D tex, Particle *particle, f32 dt) {
|
|||||||
|
|
||||||
Vector2 vel = Vector2Lerp(particle->startVel, particle->endVel, alpha);
|
Vector2 vel = Vector2Lerp(particle->startVel, particle->endVel, alpha);
|
||||||
f32 size = Lerp(particle->startSize, particle->endSize, alpha);
|
f32 size = Lerp(particle->startSize, particle->endSize, alpha);
|
||||||
f32 rot = Lerp(particle->startRotSpeed, particle->endRotSpeed, alpha);
|
|
||||||
Color startC = particle->startColor;
|
Color startC = particle->startColor;
|
||||||
Color endC = particle->endColor;
|
Color endC = particle->endColor;
|
||||||
Color color = lerpColor(startC, endC, alpha);
|
Color color = lerpColor(startC, endC, alpha);
|
||||||
@@ -104,9 +103,11 @@ bool updateParticle(const Texture2D tex, Particle *particle, f32 dt) {
|
|||||||
center.x,
|
center.x,
|
||||||
center.y,
|
center.y,
|
||||||
size, size
|
size, size
|
||||||
}, (Vector2) {hSize, hSize}, rot, color);
|
}, (Vector2) {hSize, hSize}, particle->rotation * DEG2RAD, color);
|
||||||
EndBlendMode();
|
EndBlendMode();
|
||||||
|
|
||||||
|
f32 rot = Lerp(particle->startRotSpeed, particle->endRotSpeed, alpha);
|
||||||
|
particle->rotation += rot * dt;
|
||||||
particle->pos = Vector2Add(particle->pos, Vector2Scale(vel, dt));
|
particle->pos = Vector2Add(particle->pos, Vector2Scale(vel, dt));
|
||||||
particle->elapsed += dt;
|
particle->elapsed += dt;
|
||||||
return alpha >= 1.0f;
|
return alpha >= 1.0f;
|
||||||
|
|||||||
Reference in New Issue
Block a user