+1 vote

Hi Godoters!
I have a spell node with script attached. Spell node has collision child node and a few particle nodes. I want to have a few types of spells. I am not sure if hiding child nodes is enough to save some CPU/processing power.

I wanted to do something like I have lets say particle2d called "fire" and "water".
When a spell is casted (spell have to be specific type) I hide other nodes.

Is it enough? Maybe should I do this in another way?

Thank you

in Engine by (56 points)

2 Answers

+1 vote

Hi,

instead of hiding your node, you should use the emitting property:

get_node("particles").set("config/emitting",true)
get_node("particles").set("config/emitting",false)
by (281 points)
+1 vote

I would create a different scene for each spell if they look too different. If you are afraid of copy/pasting, you can have a base Spell scene and make the spells inherit from it. This way you don't have to hide stuff, because particles are just not there as you don't need them :)

by (28,778 points)
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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.