P
Purple_Shy_Guy
Guest
I'm trying to program a knockback for when the caracther is hit by an enemy, but it's olny half working.
Only the horizontal knocback is working, but when I delete this part (first half of the code), the vertical one starts working.
Could someone help me? I'm still learning and this is my first project. Every content about knockbacks are from 2 years ago or older, so none of them helped me.
I'm sorry if this is an easy stuff and there are dumb mistakes, but as I said, I'm still learning.
GML:
if (place_meeting(x+sign(move_speed), y, Obj_Slug)) {
x-=move_speed*15;
}
if (place_meeting(x-sign(move_speed), y, Obj_Slug)) {
x+=move_speed*15;
}
if (place_meeting(x, y-sign(move_speed), Obj_Slug)) {
y-=move_speed*15;
}
if (place_meeting(x, y+sign(move_speed), Obj_Slug)) {
y+=move_speed*15;
}
Could someone help me? I'm still learning and this is my first project. Every content about knockbacks are from 2 years ago or older, so none of them helped me.
I'm sorry if this is an easy stuff and there are dumb mistakes, but as I said, I'm still learning.