right, well I created the firetorp function as a test actually. dont remember but it was a test to see if a theory i had worked.
also the emissile globally and locally. there is in fact a globaled emissile, declared in globals, and as you can see the firemissile function has a local emissile:tmissile in it...so yes it is possible that is causing an error.
I have been trying to change it but the problem I am running into is that how would I set the fields of each missile object that need to be set in that firemissile function?
because the enemy ships are at different positions each missile that gets fired needs to calculate the direction to fire the missile at, based off of where the enenmy ship that is firing at you is located. That's why I placed a for eachin loop there... it actually isn't correct as it is, its saying that for each ship in the enym ship list, and then goes on to only calculate for a single missile object. because you should use the local variable you declared in the for each in loop.
my main problem is that I am basing the logic of this emissile type off of the missile type the player uses to fire missiles, which works flawlessly. and since there is only one player, i wouldnt run into the problems I am running into here because i dont have to factor in firing from multiple instances of my player ship as I would with the enemy fleet of ships.
WHich leads me to the only conclusion, a re write of the code to handle the enemy missiles, forgetting the previous type, and taking into account from the beginning the fact that I have multiple instances to be concerned with regards to firing.
Is it neccessary though that I need a separate missile type for the enemy? The reason I made it separate and to extend the type used for the player's missiles is because I ran into trouble properly updating enemy missiles with the functions in the other type, hence a new type and ovverriding functions.
the missiles I might add work well with only one enemy ship instanced.
also the emissile globally and locally. there is in fact a globaled emissile, declared in globals, and as you can see the firemissile function has a local emissile:tmissile in it...so yes it is possible that is causing an error.
I have been trying to change it but the problem I am running into is that how would I set the fields of each missile object that need to be set in that firemissile function?
because the enemy ships are at different positions each missile that gets fired needs to calculate the direction to fire the missile at, based off of where the enenmy ship that is firing at you is located. That's why I placed a for eachin loop there... it actually isn't correct as it is, its saying that for each ship in the enym ship list, and then goes on to only calculate for a single missile object. because you should use the local variable you declared in the for each in loop.
my main problem is that I am basing the logic of this emissile type off of the missile type the player uses to fire missiles, which works flawlessly. and since there is only one player, i wouldnt run into the problems I am running into here because i dont have to factor in firing from multiple instances of my player ship as I would with the enemy fleet of ships.
WHich leads me to the only conclusion, a re write of the code to handle the enemy missiles, forgetting the previous type, and taking into account from the beginning the fact that I have multiple instances to be concerned with regards to firing.
Is it neccessary though that I need a separate missile type for the enemy? The reason I made it separate and to extend the type used for the player's missiles is because I ran into trouble properly updating enemy missiles with the functions in the other type, hence a new type and ovverriding functions.
the missiles I might add work well with only one enemy ship instanced.