Page 2 of 2
Re: Spawning an object
Posted: Sat Jan 16, 2016 4:18 pm
by CalebAnder
But the problem is the plane moves. Is there a way the x and y coordinates for the bomb to spawn follow the plane?
Re: Spawning an object
Posted: Sat Jan 16, 2016 4:25 pm
by zorg
First, please delete 3 of your 4 posts. (and next time, make sure to see whether your post went on the next page or not
)
Second, using a table for the plane's data like for the bombs, you can get the plane's x and y position in the bomb spawning function; so you'll always spawn the bombs where the plane is, even if you moved it.
Edit: apparently i managed to misread the question, sorry about that; look at S0lll0s' answer instead.
Re: Spawning an object
Posted: Sat Jan 16, 2016 4:34 pm
by CalebAnder
Yeah sorry about that. I was a bit confused
thank you so much for the help. I will try this later and tell you if it works. I really appreciate your help
Re: Spawning an object
Posted: Sat Jan 16, 2016 4:51 pm
by s-ol
or you just update the bombs with their own speed, you set the x-velocity (speed) when you spawn them and add it to the x coordinate every frame. Otherwise if you fly zig-zag the bombs will do that too, which will be pretty weird.