J
Jorex
Guest
im trying to make it so when the enemy makes contact with the player, the player bounces back away from the enemy. I managed to code knockback but it only works one way.
this is my code:
if (place_meeting(x,y,obj_enemySkeleton) && recenthurt = false)
{
flash = 3;
vspd = -4;
hspd = sign(obj_player.x-obj_enemySkeleton.x) * 4;
recenthurt = true;
audio_play_sound(snd_hurt,10,0);
alarm[1] = 2 * room_speed;
with (obj_stats)
{
hp--;
}
} else {
vspd += grav;
}
this is my code:
if (place_meeting(x,y,obj_enemySkeleton) && recenthurt = false)
{
flash = 3;
vspd = -4;
hspd = sign(obj_player.x-obj_enemySkeleton.x) * 4;
recenthurt = true;
audio_play_sound(snd_hurt,10,0);
alarm[1] = 2 * room_speed;
with (obj_stats)
{
hp--;
}
} else {
vspd += grav;
}