I’ve been updating my game, Alfie’s Adventures but I’ve come up with a problem. At the beginning of each level my sprite appears from the block it is meant to but then falls through the wall/platform it is meant to land on. The game doesn’t stop.
I’ve check out similar issues from older posts and my sprite size is consistent at 16x16 for any animation. I have also started the character for a standing still position but I can not seem to fix the issue.
Any advice? I can’t seem to move forward without fixing this issue.
Huh, fun bug. Here’s a fixed version:
The issue here is fairly subtle; when the
on overlap cat food event happens, it’s in the middle of a frame - the movements of the sprite is still not necessarily fully finished yet. So, when the event moves the sprite, it’s still in the process of moving the player the remaining distance, and potentially adjusts the sprite into the wall, where it will fall through.
Anyways, the easy fix is to just recreate Alfie each time the level restarts - that avoids the issue with the overlap continuing altogether, as the sprite will be a new version of the old one (I added a new function to do this).
That’s very subtle / not a reasonable thing for anyone else to catch – I really think we need to change on overlap to run in parallel like sprite overlap events (or I suppose we might be able to get awayh with hardening the positioning checks after the events are invoked? Have to check, wrote that logic a while ago).
Thank you @jwunderl so much for your help!
The only issue is that now the level doesn’t change. If you reach the cast food the game ends instead of taking you to the next level. Again, I’m sorry as I don’t know how to fix it - can you help?
It does? I just played through all the levels in the game that I saw and it worked for me; did you change anything from the link I sent above / is there anything different that might be causing it to happen (e.g. playing on hardware, etc).