Good Idea Games‎ > ‎

Time Throttle: Dev Journal 10

posted Mar 26, 2018, 11:28 PM by Good Idea Games
---I just found this old post that was in the queue, but never got published. Oops!--

Tonight's schedule is targeting 2 goals:
Bug fix: my player object gets stuck on walls.
New feature: laps, and fix scoring.
These should be straight forward.

Apparently it's very common for sprites to get stuck on walls in Game Maker, specifically if developers are using 'image_angle' to rotate their sprites. Which I am. Apparently this creates a situation where an image gets rotated such that the collision mask is overlapping another object's collision mask, and they get stuck.

The solution is to rotate the sprite separately from the mask (use a separate variable), and check whether the new position is colliding with an object before I move the mask to catch up.
Alternatively, in the event of a collision, I can also add a sort of 'bounce' to move the objects away from each other.
I'm going to find out which is simpler.
... 1 hour later...
None of the above helped, but I found by setting my player object as non-solid, the issue was largely alleviated. I'm going to accept the walls being just a little sticky, since this is a POC.

I also fixed my scoring.. it was an index access issue. player instances start at zero.

References
Reddit:
Object Stuck while Rotating!
This code block was hilarious. Somehow, when my object got stuck to an object, a little movement would unstuck me, but I would teleport to the same location of another instance of that object. Good Times!
Apparently 40% of the posts in some forum were about this problem, so someone wrote a handy guide!
-Setting my player object to my be 'solid' helped a bit.
Comments