Marquitos3000
Member
Hi, I´m making an RPG game and I use a tileset collision system. I have one tileset for the collision blocks and I have this in my character´s collision script:
When I touch a collision block my character teleports weirdly a bit up or down. And it tresspass a bit the block. How can I solve it?
GML:
var _collision = false;
//Tiles horizontales
if (tilemap_get_at_pixel(collisionMap, x + hSpeed * 2, 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;