I´m currently trying to create an enemy for my game that is going to look like a flying saucer with a big gun under it, i create it like two objects, one body end one gun and then i add them both to a list for updating and rendering.
My problem is: how do i get the gun object to follow along with the body object as long as the body is alive, when i kill the body the gun is going to freak out and have its own move and shoot methods but as long as the body is not dead it should be controlled (or whatever) by the body. And of cource if i could kill the gun first to make the body more or less defenseless.
I don´t even know if it´s a good idea to make this enemy in two objects, maybe you have a better idea.
And what happens when i have several ones of this type active at the same time, i guess the guns have to know wich body they belong to.
Thanks for any help on this.
My problem is: how do i get the gun object to follow along with the body object as long as the body is alive, when i kill the body the gun is going to freak out and have its own move and shoot methods but as long as the body is not dead it should be controlled (or whatever) by the body. And of cource if i could kill the gun first to make the body more or less defenseless.
I don´t even know if it´s a good idea to make this enemy in two objects, maybe you have a better idea.
And what happens when i have several ones of this type active at the same time, i guess the guns have to know wich body they belong to.
Thanks for any help on this.