neutro
Member
Hello guys.
I got this problem with the collision while next to a wall, pressing against the wall and firing.
Is it the horizontal or vertical collision or both that is not correctly coded?
Anyone here who has ideas how to solve this?
code in fire state script:
I got this problem with the collision while next to a wall, pressing against the wall and firing.
Is it the horizontal or vertical collision or both that is not correctly coded?
Anyone here who has ideas how to solve this?
code in fire state script:
GML:
vsp = vsp + grv;
if (image_xscale = 1) && (hsp != 0) {
hsp = 0.6 * walksp;
}
else if (hsp == 0) && (image_xscale = 1) {
hsp = 0 * walksp;
}
else if (hsp == 0) && (image_xscale = -1) {
hsp = 0 * -walksp;
}
else {
hsp = 0.6 * -walksp;
}
// Horizontal collision
if (place_meeting(x+hsp,y,oWall)) {
while (!place_meeting(x+sign(hsp),y,oWall))
{
x = x + sign(hsp);
}
hsp = 0;
}
x = x + hsp;
// Vertical collision
if (place_meeting(x,y+vsp,oWall)) {
while (!place_meeting(x,y+sign(vsp),oWall))
{
y = y + sign(vsp);
}
vsp = 0;
}
if (jump_up) && (state == "fire") && (place_meeting(x+hsp,y,oWall)) {
vsp = -jumpsp;
}
y = y + vsp;
image_speed = 1;
sprite_index = sPlayerFire;