0 votes

I am trying to randomize some Particles2D instances.

Instancing the Particles2D Nodes and randomizing the object members (like amount, explosiveness and such) works fine. But when assigning a ParticlesMaterial to the process_material member I can't instance a new ParticlesMaterial. This leads to the effect that when randomizing the ParticlesMaterial members (like initial_velocity, color and such) all Particles2D Nodes receiving the change. I would like to have seperate materials for each Particles2D Node.

# I want to get rid of this by creating a new ParticlesMaterial in code:
onready var particles_material = preload("res://particlesmaterial.tres")

var particles_reference = Particles2D.new()
particles_reference.process_material = particles_material   # <--

Is this somehow possible?

Thanks in advance.

asked Jan 15, 2018 in Engine by rolfpancake (1,006 points)

1 Answer

0 votes
Best answer

It is easy as that:

var particles = Particles2D.new()
particles.process_material = ParticlesMaterial.new()
answered Jan 16, 2018 by rolfpancake (1,006 points)
selected Jan 17, 2018 by rolfpancake
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.