Enemy KnockBack Help

O

Oniric

Guest
Hi guys, so I don't really understand what is going on here. Basically, im trying to add a knockback to my zombie enemy but it's not working. I've basically created 2 script states. Zombie_Movement and Zombie_KnockBack
when the bullet hits the enemy the state changes to Zombie_Knockback, I then set an alarm within the zombie_knockback script but the alarm never runs.

This is the zombie_knockback code. (I'm aware that using -point_direction isn't the best way to do a knockback effect but I still want to understand why the alarm is not running.) Thanks.

direction = -point_direction(x,y,obj_player.x,obj_player.y)
image_angle = point_direction(x,y,obj_player.x,obj_player.y)
speed = zombie_speed;
alarm[3] = 60;
if zombie_hit = false
{
state = zombie_movement;
}
 

Sergio

Member
It should be called. Ensure that you are calling the script from an object that has alarm 3 event.
 

Sergio

Member
Uhm... Maybe you are calling the script in a loop, and you are setting the alarm to 60 once and once, so it never reaches to 0. Put a debug message to check that.
 
O

Oniric

Guest
Uhm... Maybe you are calling the script in a loop, and you are setting the alarm to 60 once and once, so it never reaches to 0. Put a debug message to check that.
yeah seem like that was the issue, thanks.
 
Top