Godot Version 4.4
Question
This is my first time creating a game and learning the Godot engine, I’m working on a 2D Platformer right now with a character I control using a CharacterBody2D with move_and_slide(), I just finished up the basic movements with jumping and all that and want to move onto making the character actually take damage.
So I tried to create a test object with a StaticBody2D(It has its own scene) that I want to make it so that the character will take a hit point when it collide, only to find that the StaticBody2D don’t have anything I can use to detect collision.
After some fiddling I notice I can make the CharacterBody2D get the collider with get_slide_collision().get_collider(), which I see would return the object it collides with, but how should I go about identifying what kinda of objects it collides with? Like say I try to get its name it would just get the instanced object with a number at the end, I guess I can set it as a class but it doesn’t sit well with me(I’m not sure why exactly I just assume that I would use class if I only want it to be used for inheritance or smth), what other way can I go about it or is there a better way for me to detect collision or I should just ditch the StaticBody2D and opt for other kinds of nodes?