this post was submitted on 16 Oct 2024
75 points (100.0% liked)

Godot

5885 readers
32 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

founded 1 year ago
MODERATORS
 

Here's a tutorial I wrote on using components to help keep your code organized.

you are viewing a single comment's thread
view the rest of the comments
[–] mrsgreenpotato@discuss.tchncs.de 3 points 1 month ago* (last edited 1 month ago) (9 children)

Why are people still using string references? Like in the case of "Bumpable" - this could be a class name and reference could be via the class name instead of checking the node name by string. String references are super dangerous, as you will get a potential error only at runtime if you make a typo, IDE can't help you. Don't get me wrong - I like the idea behind component pattern and I use it myself sometimes, but the execution could be better in my opinion, unless I'm missing some obvious reasons for doing it this way.

[–] TheLongPrice@lemmy.one 1 points 3 weeks ago (1 children)

That would definitely be an improvement, using classes is probably more robust. In my case, the project wasn't too huge and it was solo, so I never hit issues with string references.

[–] mrsgreenpotato@discuss.tchncs.de 1 points 3 weeks ago* (last edited 3 weeks ago)

It's a good practice to adhere to proper design patterns even on smaller projects. I also work solo on small projects :). It doesn't really cost you anything to work with classes, it'd even say it's easier once you get a hang of it

load more comments (7 replies)