Actually, looks like this is a school assignment. We can’t give you the answer but we can point you in the right direction.
First of all, enemy_y is undefined. Did you mistake it for a different variable?
Second of all, math.randomseed(os.time()) and math.random(0, 800) is giving an error. Check out this StackOverflow post, it may help.
Third of all, all your variables are global. It’s better practice to use local variables. You can make them local by using the keyword local.