• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Idea for an advanced snap to grid system help!

P

ProjectJM

Guest
Hello, I'll try to be as clear as possible: all I need is snap my player to a 32x32 grid when he stops moving.
Using the normal function Move_Snap is not worth it because it ends up with a laggy and a malformed snap.
So, basically i'm tryin' to make a Johnny Megatone remake, a game I used to play on the television several years ago. There is a GIF in Google which could help you understand a bit more my question!

Johnny is the only game with those "strange" movements btw :D

https://www.google.it/search?site=i...30k1j0i24k1.NQcYsy6sgBc#imgrc=XLHSmUFCStKEuM:

https://www.google.it/search?site=i...30k1j0i24k1.NQcYsy6sgBc#imgrc=3q2Bu9oUiNEM0M:

https://www.google.it/search?site=i...30k1j0i24k1.NQcYsy6sgBc#imgrc=f66FiBbu8M8dBM:


So, in theory, what should happen in my remake if the game in the following link was mine ? >

https://www.google.it/search?site=i...30k1j0i24k1.NQcYsy6sgBc#imgrc=Va__c81aVIcyAM:

Being closer to the ladder, positioned to a 32x32 grid and pressing "right" ONCE, I should snap to the ladder perfectly without a pixel of inperfection! :D
 
P

ProjectJM

Guest
I explained one here:

https://forum.yoyogames.com/index.php?threads/building-sprites-in-a-selection-box.14540/#post-95107

But in your case, you would do this:
Code:
x = x & ~31;
y = y & ~31;
Thanks! It's still problematic though :D
Isn't there a way to smooth the snap ??

Another thing: I use an alarm to stop the movement, so when you press (right) once, the player will move until the alarm reaches its end. So, is there a way to implement the alarm time based on how many time it takes for the player to reach the closest 32x32 grid ? So the player will stop only when the alarm reaches the 32x32 grid!
 
Top