I'm having a problem with collision, for some reason if you be in a exactaly spot (the border of the block) your character will slowly enter the block switching in colliding and not colliding, and then after a some progress he stops, i have no ideia why it happens, the white rectangle behind him is his collision mask and the red block it's the wall, here's my collision script:
//collision
if place_meeting(x + hsp, y, oWall){
while !place_meeting(x + sign(hsp), y, oWall){
x += sign(hsp);
}
hsp = 0;
}
if place_meeting(x, y + vsp, oWall) {
while !place_meeting(x, y + sign(vsp), oWall){
y += sign(vsp);
}
vsp = 0;
}
the numbers 1 and 0 represents if he's colliding with the wall ( the above is for Y collision and the lower is for X), and when he's in that state (slowly entering the block) he keeps changing between 1 and 0, and then he stops after a while, the number keep in 0 (since now he's colliding), but what i wanna know is, why he enter the conor of block since the rectangle is colliding with the red block, how to solve it.
PS: he works perfectly if not be in that exactaly border of the block (it counts for all blocks)
PS 2: he have the exactaly same collision mask for all sprites&frames
slowly entering the block (it counts for every other red block no matter where is while is possible to collide with the border):
stops and stay there until i move him.
Collision works perfectly in other places
//collision
if place_meeting(x + hsp, y, oWall){
while !place_meeting(x + sign(hsp), y, oWall){
x += sign(hsp);
}
hsp = 0;
}
if place_meeting(x, y + vsp, oWall) {
while !place_meeting(x, y + sign(vsp), oWall){
y += sign(vsp);
}
vsp = 0;
}
the numbers 1 and 0 represents if he's colliding with the wall ( the above is for Y collision and the lower is for X), and when he's in that state (slowly entering the block) he keeps changing between 1 and 0, and then he stops after a while, the number keep in 0 (since now he's colliding), but what i wanna know is, why he enter the conor of block since the rectangle is colliding with the red block, how to solve it.
PS: he works perfectly if not be in that exactaly border of the block (it counts for all blocks)
PS 2: he have the exactaly same collision mask for all sprites&frames
slowly entering the block (it counts for every other red block no matter where is while is possible to collide with the border):
stops and stay there until i move him.
Collision works perfectly in other places