Godot Version
v4.2.2.stable.official [15073afe3]
For background, I’m experienced with programming but inexperienced with using graphical development engines like Godot. I’ve followed the popular Brackey’s tutorial this weekend and had no problems getting through the entirety of the tutorial and implementing exactly what he did.
Now, I’m trying to make some refinements, and the one that I’m currently stuck on is getting the Slime monsters to behave like the player body such that they will be drawn to the floor of the TileMap with gravity, just like the player is, and ideally unable to just walk through solid tiles.
I will attach a short GIF demonstrating the issue. I have placed the Slime slightly above the floor to demonstrate that he is floating and not being affected by gravity. Per the tutorial, the base node of the Slime ‘scene’ is a 2D Node. My initial hunch was that he would need to have a base node type of RigidBody2D instead, but after changing the base node accordingly, he continues to float in the air.
The node layout of the Slime scene and the associated scripts are as follows:
When I changed the base node to RigidBody2D, I did verify that it had a mass assigned:
I have googled for solutions to this issue, as there have been a couple other mentions I have seen of people trying to do similar, and so far the only one I’ve seen that sounded like it was solved involved changing the Slimes to use a CharacterBody2D base node and then applying overrides to cause them to not be affected by player input the way that the Character is meant to be. This seems to me like an odd workaround and I’m sure that there must be a more appropriate solution to this problem. Would greatly appreciate if anyone could get me going in the correct direction.