[SOLVED] When diagonally walking with the top-down extension into several consecutive sprites, you get stuck?

Here’s an example:
https://imgur.com/a/ppbYr5x
Don’t mind the lag, but notice how it’s getting stuck.
I believe it’s getting stuck on the edge of the collision mask of each tile.
I’m really not sure how to fix this.
Another problem I’m having is I don’t know how to make it so when the player isn’t moving, play the idle animation. I already tried using the top-down “Player is moving” (inverted of course) and made it play the idle animation, but had no luck, it only works when the controls aren’t being pressed.

Sorry, it’s rather difficult to understand when it’s lag and when the player is getting stuck - we can’t see the keypresses you are making. Could you publish it on gd.games so we can experience it?


Yes, because if you press a key then you trying to move the player.

If it should also happen when the keys are pressed but the player is blocked from moving, check if the player’s X and Y positions stayed the same between frames. If they are, set the animation to idle.

1 Like

Here’s the link.
https://gd.games/instant-builds/58250e7f-6152-459c-89b8-753e495c8de6

I’ll try, thanks for the suggestion!

Images of your animations need to be same size
Otherwise what you describe can happen

There is condition to check angle of movement
And to check if player is moving
And you can combine it with with variable and properly named animations
To streamline your movement

The animations are all the same size and are using the same hitbox.
The same with each of the tiles.
The only animations I’m using are idle and walking animation, and I’m just flipping it based on which direction the player is moving.
What else could be the problem?
image
I’m using this for separation.
The angle offset of movement is simply 0.

Check like literally go into each animation
Collision masks
Check each frame
Just to be 100% sure
And trust me you wanna check it

Other than that i have no idea

That’s weird.
I checked all of the frames of each animation and they were all the same size.

This is using the debugger.


It won’t let me move up or down when I move towards the wall.

So try to recreate what you have in new scene
Cause it is impossible to do that on its own
Test it each step when you add something new
Like simply check in preview does it work

I tried recreating a simple version of the game, with just a character and a tile.
I place a few tiles in a line going down and got the same results.
I think I’d need to merge their hitboxes somehow, or make another hitbox over them.

Wait do you have separate object as hitbox?

No, that’d be terrible for performance, it’s an infinite procedurally generated game, I’d only do that if I need to.
I’m just using several different 64x64 randomly generated tiles, and each tile has a separate hitbox, of course.

I actually never tested it
But if you make wall out of blocks then idk if that should work properly or bug out as you experience it

So place few blocks manually (i mean hotboxes only)

And then walk to them with your player and see if same thing happens

1 Like

I did, the same thing happened, as expected.
Again, I tried making a recreation with a minimal amount of code and sprites.
It seemed like making a wall out of blocks glitches the hitboxes for some reason.
You should test it, because for the life of me, I can’t find a fix.

I fixed it!
I just replaced everything with a tilemap!
It worked great, not only did it improve my game logic and such, but the collisions are amazing!

3 Likes