Stuck in corner *SOLVED*

What causes this? It’s pretty annoying. I’ve tried changing the collision to slightly higher or lower but this still occurs. Sometimes, I won’t even be able to jump from that spot.

I think it’s caused by the size of the character changing when he moves. In fact, when the character doesn’t move, its width is slightly lower than its width when he is moving. So, when you start moving, the character gets stuck in the platform.

To solve that, you should use a smaller collision box (you can edit it inside the sprite editor).

aahh so instead of editing the box, I should have edited the player! Thank you. But do you know if there’s another way to solve this? I hate editing collision box cause I don’t really know the dimensions of the character and what not. Also, dragging the corners of the collision box with my mouse is iffy and will result to inconsistency in the player’s collision boxes :cry:

For me, it’s the only good solution.

Okay I appreciate your help. I think I will just change the player sprite altogether since it’s just a placeholder anyway. Again, thank you for the help! :slight_smile:

I had similar issue when making Candyman Saga. Size of character wasn’t problem as all frames were same in size, in all animations. To this day I don’t know what caused it and I didn’t really fix that either as it was hard to reproduce.

Here’s one hack that I think may work (not tested). Make invisible, 1 pixel high and as wide as your character sprite that is invisible in game. Make it so origin point in it is in the center. Add to that invisible object platform automatism. Make actual player object and make it so x of origin point is centered and y of it is on bottom of the player. Now do an event that is executed always and sets playerobject’s x/y to invisible object’s x/y

The only downfall I can see is that player could pierce through ceiling, haven’t figured how to fix this one yet.

This is caused by different sized collision polygon between the animations and frames of every animation.

This a very common problem and it deserves an entire topic to explain all the ways in what you can deal with it.

But by now, these is are two possible solutions:

Note: my GD is translated to spanish, so I’m not really sure of the name or label of some buttons, menus and windows, but will get the idea.

consider this: A - represents the width of the biggest (width) frame, taking in conideration all the animations for the object player. B - represents the heigth of the smallest (heigth) frame, taking in consideration all the animations for the object player.

Solution 1:

In a picture editor, edit the width and height of each frame of each animation of the player object to the same size (always ) where A is the new standard width for all your frames and B is the new standard height for all your frames. Keeps your character foot always at the bottom bound level into the frames.

Solution 2:

Edit the collision polygons of each animation to the same size:

[]Go to the animation editor of the player object and press the “edit collision box/polygon” button.
[
]In the collision box/polygon editor make sure that the “apply to all frames” buttons is checked.
[]Press the “create new collision box/polygon” button.
[
]The program will prompt you the width, height and rotation angle of the polygon. So, set the values to default = [Enter][Enter][Enter]
[*]Now we will edit the collision box/polygon bounds: there are four vectors (X,Y values) for every corner of the collision rectangle in the collision box/polygon editor. The first represents the top-left corner of the rectangle, the second is top-right, third is bottom-right and fourth is bottom-left. If you double-click one of this vectors the program will prompt you the X and Y values. Using this, change the X, Y values of each vectors to this:

Top-left: X: 0 Y: 0 Top-Right: X: A Y: 0 Bottom-right: X: A: Y: B Bottom-right: X: 0: Y: B

[*]Now make this for every animation of the object player.

Now your main character will never get stuck!
But this solutions are not perfect, play with the collision box size to reach different results.
Although, solution 2 works if your animation frames keeps similar size between them, so keep the width and height diferences small or your animation will look terrible.

I’m sorry I don’t get what you mean. If it’s not much of a trouble could you elaborate?

I’ve tried this but it looks too buggy. Since the running animation makes the player wider, when the player is just standing around, there’s a noticeable invisible barrier between the object and player. Maybe I should just use sprites that don’t change size at all.

TY I will try this and edit with result.

Yes, I understand your point. But now that I had show you how to edit the collision polygons of a frame or animation you can play with the collision polygon width and change it for some frames, for example you can set a thiner collision polygon for the idle animation even if the real frame (along with its invisible borders) are wider.

You can even make many collision polygons for a specific frame of a specific animation of a specific object (in this case the player object) and set a more complex and realistic collision system for your animation that more accurately notice (for example) the aproximately bounds of your animation arms and legs when your character is walking. But that means that you will need to edit by hand a large amount of collision polygons for every single frame of every single animation of your main character. If you decided to do that, you can click and drag the vertices of your polygons with the cursor (that will make it slightly easier than always type the X and Y coordinates of the vertex).

Anyways, important things here to avoid get stuck on the wall or the floor are:

Never make abrupt changes in your collision polygons from one frame to another (that’s what get you stuck in that corner when change from the idle or jumping animation to the walk animation). Let the collision polygons flow with your animation or set a specific set of polygons that more or less works for all your frames of every single animation. If the collision polygon of your frame is abruptly ascended or descended from one frame to another that will set your character in a falling loop or get you stuck on the floor.

Keeps your main character feet docked to the bottom border of your frames. That reads don’t make your main character jump into the frame picture, even if your main character shape and pose change for the jump animation (and whatever other animation) don’t elevate the character picture into the frame, let the game and the jump system ascend or descend (or move in any direction for any other purpose) the whole frames of your animation.

Yes I get what you mean now. Specially with the consistent collision box. It means I don’t have to redo animations as long as I keep a consistent collision box. TY!

1 Like