StaticBody2D not appearing

Godot Version

Godot 4.2

Question

I just started using Godot (and in-depth text based coding in general) after using Scratch for a couple of years. As my second project, I am trying to make a platformer. I have a CharacterBody2D with child nodes ColorRect and CollisionShape2D. I made some simple code to move the player around, and it’s working fine. I created a ground node originally with the same child nodes as a StaticBody2D. I later changed the ColorRect to a mesh, although I would prefer to use the ColorRect as it seems simpler. Both of those nodes are children of a base Node called main. I ran the project, and the player shows up just fine, but the ground is gone. I tried some setup with a script on the ground node that makes a vector, moves the ground to 200, 200, then setting its position there. Then I tried manually moving it to 200, 200, but still no luck. Any ideas?

That doesn’t seem to work, and if it did, why would I need to make a box around the ground and not around the player?

I still don’t know why I would need to draw a box. I also don’t know what happened. Since I wasn’t all that far in and really only have one script, I decided to copy over everything into a new project file. After some reorganization, (probably the reason it wasn’t working) everything worked.

Okay, I figured it out. I had made the ground a separate scene, and I shifted the ground down in both the main scene and the ground scene, which compounded, and pushed the ground offscreen.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.