0 votes


I have found two ways of writing the same code. But which one is the right way to do it and why?

        $Node2D/Particles2D.amount = 30

in Engine by (25 points)

2 Answers

0 votes

I'm going to take a guess and go with the first one.

   $Node2D/Particles2D.amount = 30

Why, because it sounds simpler, it just states an amount not having to set anything wich sounds like a process or at least a thing.

Unless something specifically requires the amount to be set ofcourse. Maybe there's the exception?

Don't listen to me, i don't know nothing.

by (103 points)
0 votes

Just making sure it is out there, if you are using setters and getters (like the set_amount(n)) you are using you shouldn't be able to do it the first way.

So it's a property of Object Oriented Languages to have a private class(where you can't access the property by Class.property because duh, Private Class) you have a public method in that class that sets and gets the value for that property.

So by all means go by KND2501's suggestion. KISS(Keep it Simple Stupid) all the way

by (18 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 Frequently asked questions and 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 [email protected] with your username.