Class Names and groups

Hi all,

Up to know I had been working under the assumption that the only way to identify a specific object(s) was to use the: group tool. I had used it a number of times in my first game to name: ladders, hero, bombs, ropes and certain sprites:

using: if (body.is_in_group(“whatevs”)):

I just never really thought anything about it

And today I find out that you can use class name for basically that same sort of thing. It’s sort of shocking what I don’t know about this game engine.

Learning all the time :sunglasses:.

I would say to all those who come that this is not the same thing. Use groups for broader subjects like “killable” while classes should be for much more specific things like (if using the example above) “enemies” and “trees”.

I would just like to say that I didn’t say they were the same thing. I said the same sort of thing. In that it allows, specifically an Area2D node, to identify an object(s) using different methods. How a person decides to use those two is up to the person - there may be even more I don’t know

If you feel that I was conflating the two that was not the intention.

1 Like

I didn’t say you did. I just wanted to stop beginners from having this assumption.


I am a beginner :rofl:


Sorry bro, I know. I just used to think class_name were everything before I knew about groups, so I didn’t want anyone else to think that.

1 Like