Well, that's some different code than you posted last time, but I'll try to help.
You're mistaken by referencing "Ship.X" and "Ship.Y" in your fire torpedo function. You are also mistaken by referencing "EachEnemy" in your fire missile function. Neither Ship nor EachEnemy exist within the scope that you are referencing them. Actually, I'm assuming ship is a global value that represents your players object. But why then does your fire torpedo function always use Ship.X and Ship.Y? Shouldn't it take the X and Y of the firing ship as parameters?
etMissile.fireTorp()
Why are you calling fireTorp, a function, as a method?
What you need to do is to give the enemy type an Update
method. There's no reason that code that only acts on a single type should be a function. No, whenever you have code that only modifies a single type, it should probably be a method of that type. So then, each frame you do this
local EachEnemy:TEnemy = Eachin EnemyShipList
EachEnemy.Update()
The actual code of update should handle repositioning and drawing the ship, and then evaluating the test conditions to see if the ship should fire a missile. Also,
make sure give the enemy type a "LastFired" field. There is no reason that field should belong to the missile. Instead, each enemy should track when it was last fired. The way you have it now, the missile type itself is storing the last time it was shot (presumably in a global variable given the problems you are having) and hence, whenever ANYONE shoots it prevents everyone else from firing until that time has passed.
Lastly, make the FireMissile() a method of the TEnemy type. So now you've got an Update() method inside of the TEnemy, and if the test conditions pass inside of Update() it calls FireMissile(), also a method inside of TEnemy. FireMissile needs to reference the X and Y field of the object calling it, which is trivial once you've made it a method of that type.
Lastly, you can get rid of this line in your last block of code
If ListIsEmpty(tenemyship.eshiplist) = False
If eshiplist is empty, the "For Eachin" loop simply won't execute. Hence, you are wasting cycles testing for a condition that will never be true at the time of testing.
Lastly, and this is
the most important thing you can do to help improve your coding and catch random bugs is to use STRICT. In fact, I'm not trying to be rude, but I'm not going to offer anymore help until you start using it. Not using strict makes it exponentially harder to debug, especially when you only provide snippets of code. It's not worth my (or others) effort to try and help with your code when you aren't using strict as it's simply too hard to tell what might be the problem (for instance, you can reference variables that should be out of scope, but how can we tell?)