2D Game Movement Problem?

Godot Version

4.2.2

Question

Hello All,

I am having a problem in my game for the last few days I have been working towards this with a wall-climbing, jumping system for my 2D game. I made a quick wall sprite that I could jump towards, grab on (well the sprite is supposed to grab on when the sprite animation is working) and move off an then jump towards whatever. Everything was working with the single sprite:

ala this:

Could climb up and jump off both sides of the “wall”

So, I set up a second sprite (duplicated and then brought in via child scene, same result) to see if I could jump from one to the other and then correct the inevitable problems that are going to crop up, when something strange happened, the movement to the right stopped right where the boundary of the second sprite started, and I can’t think of a single reason why that occurred. Not a one :open_mouth:.

Ala this:


Ol’ Jolly Roger just stopped running when he was underneath the block and nowhere near it.

Here is the elements that are used to make the wall sprite and an hoping that one of you might be able to realise why there is a problem. Piccy here:

As always any help you can give is greatly appreciated.

Regards.

Huh - looks like a StaticBody 2D works whereas the Rigidbody2D didn’t :anguished:.

I can’t understand why?

Have you tried testing with “Visible Collision Shapes” on in the top-left debug menu? Using a RigidBody2D means the wall’s stopping collision will be affected by gravity and other forces, it is very likely it simply fell down. Since the sprites are not children of the RigidBody you do not see this change visually.

  • if you want it to stay put, use a StaticBody2D
  • if you want control, a CharacterBody2D
  • if you want animation like a moving platform, a AnimatableBody2D
  • if you want to give in the whims of physics, a RigidBody2D

That was it! It fell down, well, I wasn’t expecting that behaviour at all.

Just added it back it to see and the the rigidbody 2D is now placed next to the wall, that is next to the staticbody2D :grin:.

Thanks for the reply - I made the wall scene about a month ago and made some major changes to the game since then and the rigidbody was the first thing I came up with when I created it. Will remember to check with Collision Shapes in the future. All good now!

Much appreciated.

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