Running into a Bug? - Bug #1


Howllo Everyone!
I've been getting a few bug reports on suddenly getting stuck in an object, more specifically at the corner of one.

What does it look like?
You look like your at the corner of an object, and are unable to move. An object (to clarify) could be a Tree, Water?, and even a Rock.

How does it behave?
As mentioned, your unable to move, and your in just the right position that your not close enough to try an cut/mine the obstacle that your stuck on.

Why does it happen/What causes it to happen/How to replicate it?
This is due to the collision system I programmed, which is set to make checks in either X or Y directions, but does not fully check in a diagonal direction of both X and Y. The movement system is designed such that it checks either direction (meaning above/below or left/right) and will decide if a collision happens, then it will move the player. However, if both X and Y are pressed with the obstacle precisely perfectly diagonal to the player's input such that it does not flag collision with X OR Y, you move into the object.

What can I do about it/is there a way I can fix this in game?
YES! There is a solution! You just need to run away from the bug. I'm not kidding, hold [Shift] (the Run button) and direct your character away from the obstacle.
In case for some reason this solution does not work and your stuck beyond saving, you can use this LAST RESORT technique. Press [O] to enter debug mode, then hold [Shift] and move, you will then be able to move through objects and place yourself in a safe place. Press [O] again to exit debug mode.

Why does this fix work?
Referring to the normal fix, it works because normal movement checks in such a way that it is still within the boundary of the object your stuck in. But Running movement checks slightly at a point farther away than normal movement checks (in fact double what normal movement checks). So by running, your telling the collision check to check further ahead, and since your not in the object at that new distance, you are then moved to that new location and are now freed!

I hope this lil article helps to understand what's happening when it occurs and how to go about getting out of it.

Thank you for your time and have a nice day!
Image provided by Ryan Linehan on itch.io

Get The nth Tilecraft

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.