Time to debug. Throw sys_exit(""); in your script first at the start of your enemy_act. It should end your game pretty much instantly. If if it does then you know that function is called. Then put it after your while(my) that way if the game ends you know your while loop was either never called or only called once. Then throw it in different parts of your code to see what is called.
Also use beep(); so you know how often a function is called. Beep and sys_exit are my favorite tools to use in game development.