Add fireball particles, add max lifespan to fireball

This commit is contained in:
2024-02-10 11:39:01 +01:00
parent 1c6fab51c6
commit 1487d67a3b
5 changed files with 57 additions and 38 deletions

View File

@@ -570,23 +570,9 @@ static void renderGame(Game *game, float dt) {
InputState *input = ecs_singleton_get_mut(ECS, InputState);
if (IsKeyReleased(KEY_SPACE)) {
ParticleEmitter emitter = {
.emitterLifetime = 2.0f,
.targetParticles = ecs_id(ParticleLayer1),
.data.emmitRate = 1.2f,
.data.emmitVariance = 1.0f,
.data.emmitVarianceMin = 0.0f,
.data.emmitVarianceMax = 1.0f,
.pos = input->mouseWorld,
.data.startColor = { 210, 0, 0, 210 },
.data.endColor = { 110, 10, 10, 110 },
.data.minLifetime = 1.0f,
.data.maxLifetime = 2.2f,
.data.minStartSize = 4.0f,
.data.maxStartSize = 6.0f,
.data.tileID = getParticleTypeTile(PARTICLE_CIRCLE),
.data.blend = BLEND_ADDITIVE
};
ParticleEmitter emitter = GET_FIREBALL_EMITTER();
emitter.pos = input->mouseWorld;
emitter.targetParticles = ecs_id(ParticleLayer1);
ecs_entity_t e = entityCreateEmpty();
ecs_set_ptr(ECS, e, ParticleEmitter, &emitter);