#How do I modulate one set of particles without the other

4 messages · Page 1 of 1 (latest)

serene grail
#

Hi, I am trying to instance a particle effect when my ship dies. I want half of these particles to be blue while the other half are orange. The code below shows how i have tried doing this by instancing my particle scene twice and using to set_self_modulate() to change their colour however this changes the colour of all instances of this particle. How would I only set the modulate of one instance? Thanks.

func _on_ship_1_show_death(pos):
    var effect_intsnace: GPUParticles2D = death_effect.instantiate()
    for i in range(2):
        effect_intsnace.emitting = true
        if i == 0:
            effect_intsnace.set_self_modulate(Color8(255,225,225))
        else: 
            effect_intsnace.set_self_modulate(Color8(0,0,0))
        effect_intsnace.scale = Vector2(4, 4)
        effect_intsnace.global_position = pos
        $GUI_Elements.add_child(effect_intsnace)
        await get_tree().create_timer(0.2).timeout
serene grail
#

any ideas?

hybrid garnet
#

It doesn't look like you're instancing it twice (although I could just be misreading the code)

#

Try moving line 2 into the loop