V
victinistar76
Guest
I followed two different tutorials and it came out with the same outcome. The collision does not work properly and will not work with the way it is set up. Here is my code:
Code:
var bbox_side;
//Vertical Movement
if (vsp > 0) bbox_side = bbox_bottom; else bbox_side = bbox_top;
if (tilemap_get_at_pixel(tilemap, bbox_side+vspeed, bbox_left) != 0) || (tilemap_get_at_pixel(tilemap, bbox_side+vspeed, bbox_bottom) != 0)
{
if (vsp > 0) y = y- (y mod 64) + 63 - (bbox_bottom - y);
else y = y - (y mod 64) - (bbox_top - y);
vsp = 0
}
y += vsp;
//Horizantal Movement
if (hsp > 0) bbox_side = bbox_right; else bbox_side = bbox_left;
if (tilemap_get_at_pixel(tilemap, bbox_side+hspeed, bbox_top) != 0) || (tilemap_get_at_pixel(tilemap, bbox_side+hspeed, bbox_right) != 0)
{
if (hsp > 0) x = x- (x mod 64) + 63 - (bbox_right - x);
else x= x - (x mod 64) - (bbox_left - x);
hsp = 0
}
x += hsp;