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

GML Weird bouncing effect with tile collision

N

nired360

Guest
Hi, am having a problem with tile collision and gravity in my 2d platformer i used the code from shaun spalding's video for tile collision and implemented gravity but whenever my character hits the floor, he starts bouncing non stop, it's driving me nuts, plz help.
Here's the code for vertical collision :
//vertical collision
if (vsp > 0) bbox_side = bbox_bottom else bbox_side = bbox_top;
p1 = tilemap_get_at_pixel(tilemap,bbox_right,bbox_side+vsp);
p2 = tilemap_get_at_pixel(tilemap,bbox_left,bbox_side+vsp);
if (p1 == 1) or (p2 == 1)
{
if (vsp > 0 ) y = y - (y mod tilesize) + (tilesize -1 ) - (bbox_bottom - y);
else y = y - (y mod tilesize) - (bbox_top - y);
vsp = 0;
}
y += vsp;

tilesize is 16x16 btw
 
Top