• 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!

knockback on Grid

T

Tom Barylov

Guest
Hello folks!

I have a couple of blocks in my room,than can be moved by player on a grid of 64x64.
if I stop them on collision, they stop. Problem is they are not on the grid anymore, since collision happens afer 1px crosses the other.
How do I solve that problem?

The block should collide and stop with others of its own kind or the wall.
I though of putting int a knockback of 1px. that would work for that project. I would like to code it on the block it self.

could someone help me out please?
Thanks!
 
Q

Quinnlan Varcoe

Guest
What do you mean by not on the grid?

Are you trying to ask how to check if an object is about to collide with something?

Sean spaulding covers this in one of his tutorials pretty well.

If I understand you correctly then you want to be able to calculate:

place_meeting(player.x+player.speed,player.y,obj_block)
place_meeting(player.x,player.y+player.speed,obj_block)

Hopefully this is what you were asking and it cleared it up a bit.
 
T

Tom Barylov

Guest
hey there, Just solvedthe proble with place meeting, just like you wrote, thanks for helping out a noobie :) also I've now been watching his vids, very helpful!
 
Top