It's 2's day!
(Actually it's a Thursday and it's 2024 but you know what I mean.)
And not too long ago I announced development of my side project, Room Service, and shown its prototype footage from my YouTube. Today I got something pretty neat to show you, Here's more footage on the Project: NG Twitter:
https://twitter.com/PROJECT_NG1/status/1760764361680073085
And as you see the game looks more polished than the last few days ago, let me show you a small little trick on how I made the ground collisions seem pixel perfect.
"Sticky Landing"
As you can see from this gif here, the character is always sticking to the pixel of the ground after landing on the ground, In GameMaker this doesn't do that by default, and pixel perfect collision is hard to code, That I have an easier solution to that, not as tedious as coding it all in,
Here's how it works
The red line you see on the ground is known as the "Character Y Snapper", it snaps the character right back to its bottom y position, since it's a 1x1 game upscaled 3x each 6x6 pixel is considered a 1x1 pixel to them, thus sending the player back down on the very pixel where they're neither away or in the ground. Only after they land, or is close to landing.
Here's a better look on how it works.
You can see from the y position string that it's an even number every time they land.
And the jump_land_timer prevents the player from landing as soon as they leave the ground, making it too sticky.
Why am I doing this method exactly besides this being hard to code otherwise?
Here's what it looks like without the y snapper:
If you squint you can see that they sink below or float above the ground a bit each time they land, which causes an inconsistency,
Here's a better look:
You can notice how the y position is inconsistent.
With the y snapper placed on the ground it makes the landing seem more polished and pixel perfect without having to code the pixel perfect collision detection.
That's pretty much it for today, tomorrow I shall discuss the door mechanics.
Ciao!