Skip to content

Commit

Permalink
Another improvement to explosion effect
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanlangston committed Jan 8, 2024
1 parent 87e074c commit de542f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Models/Explosion.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub const Explosion = struct {
var particles: [PARTICLE_COUNT]Particle = undefined;
for (0..PARTICLE_COUNT) |i| {
particles[i] = Particle.init(position, GetRandomColor(color), Shared.Random.Get().float(f32) * 4);
if (@as(f32, @floatFromInt(i)) > blastRadius * 2) break;
}

return Explosion{
Expand Down Expand Up @@ -60,8 +61,10 @@ pub const Explosion = struct {
}

self.particle[i] = particle;

if (@as(f32, @floatFromInt(i)) > self.blastRadius * 2) break;
}
self.active = nonActiveCount < PARTICLE_COUNT;
self.active = @as(f32, @floatFromInt(nonActiveCount)) < self.blastRadius;
}
}

Expand Down

0 comments on commit de542f6

Please sign in to comment.