How do I make my character move in open air and collide correctly against the frame around it?

I want my heart character to move in open air without gravity or anything. I also want it to only move around in the light purple area and collide with the dark purple area. I tried to do it, but the heart won’t collide with the frame around it. To move the heart, I made it change positions, but I saw somewhere that I should use move_and_slide. But the tutorials I found for that are used for regular character movement where there is a ground that the character will be on. Can anyone help me?



I’m not sure about the rest of it, but have you tried changing your player’s motion mode to floating? That’s what’s used for top-down games. Under Characterbody2D in the inspector

Thanks! I figured out how to make the movement smoother and better for top-down games based on that, but for some reason my character still doesn’t collide against the frame. I’ll keep looking :slight_smile:

I changed my movement code to better fit top-down game movement, but the collision with the frame still doesn’t work. I would love if someone might know a way to fix it!
New movement script:

1 Like

I managed to fix it after messing around for a couple hours!

2 Likes