Marquitos3000
Member
Hi, I´m making a tile based collision system and I use this script:
The problem is that I want to increase the number of pixels that my character detects to stop horizontaly.
Because my charachter´s leg trespass the collision block. I´m ok with the vertical collision but not with the horizontal collision. What can I do? By the way, It´s origin is on the bottom center.
GML:
var _collision = false;
//Tiles horizontales
if (tilemap_get_at_pixel(collisionMap, x + hSpeed, y))
{
x -= x mod TILE_SIZE;
if(sign(hSpeed) == 1) x += TILE_SIZE -1;
hSpeed = 0;
_collision = true;
}
//Cometer movimiento horizontal
x += hSpeed;
//Tiles verticales
if (tilemap_get_at_pixel(collisionMap, x, y + vSpeed))
{
y -= y mod TILE_SIZE;
if(sign(vSpeed) == 1) y += TILE_SIZE -1;
vSpeed = 0;
_collision = true;
}
//Cometer movimiento vertical
y += vSpeed;
return _collision;
Because my charachter´s leg trespass the collision block. I´m ok with the vertical collision but not with the horizontal collision. What can I do? By the way, It´s origin is on the bottom center.