E
Emre
Guest
Hi guys i have a question. I have this code in the step event of my player.
if keyboard_check(vk_right) and !place_meeting(x+5,y,obj_wall){
x += 5;
}
if keyboard_check(vk_left) and !place_meeting(x-5,y,obj_wall){
x -= 5;
}
if keyboard_check(vk_down) and !place_meeting(x,y+5,obj_wall){
y += 5;
}
if keyboard_check(vk_up) and !place_meeting(x,y-5,obj_wall){
y -= 5;
}
The collision does work but its not pixelperfect for vertical collisions while it is pixelperfect for horizontal collisions. Here is how it looks like:
As you can see in the images above the vertical collision is different than the horizantal collision which is strange since i use the same piece of code for both. I really want to know why this happens. It has nothing to do with the sprite mask. I have no other code in other objects or events. This is literally all the code i have in my game. Please someone explain.
if keyboard_check(vk_right) and !place_meeting(x+5,y,obj_wall){
x += 5;
}
if keyboard_check(vk_left) and !place_meeting(x-5,y,obj_wall){
x -= 5;
}
if keyboard_check(vk_down) and !place_meeting(x,y+5,obj_wall){
y += 5;
}
if keyboard_check(vk_up) and !place_meeting(x,y-5,obj_wall){
y -= 5;
}
The collision does work but its not pixelperfect for vertical collisions while it is pixelperfect for horizontal collisions. Here is how it looks like:
As you can see in the images above the vertical collision is different than the horizantal collision which is strange since i use the same piece of code for both. I really want to know why this happens. It has nothing to do with the sprite mask. I have no other code in other objects or events. This is literally all the code i have in my game. Please someone explain.