# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### Code Snippets / Rocket Trails.

Message
Posted: 2nd Oct 2002 20:05
I got a couple of request asking how I did the rocket trails in Captain Zero. Well here's how.

(first you have to have 99 ghosted plains with an image of a lengthwise line of vapor however thick you want it
for me it's objects 7500-7599. Also you need to dim rtimer(99)

Then there are 2 functions.

The first is called when the rocket moves.
X# and Y# and ang are the rocket's x and y position and zangle when the thrust object is made.
The second is called every loop and makes the segments dissappear when their time is up.

function makethrust(x#,y#,ang)
for i = 1 to 99
if rttimer(i)
Posted: 2nd Oct 2002 20:06
Oops...
here's the first function:

function makethrust(x#,y#,ang)
for i = 1 to 99
if rttimer(i)<=0 `finds the first available rocket thrust object.
rttimer(i)=20
show object i+7500
position object i+7500,x#,y#,320
zrotate object i+7500,ang
exitfunction
endif
next i
endfunction

here's the second:

function rthrust() 'lowers the timer for each thrust segment and
for i = 1 to 99 'gets rid of them when they're time is up.
if rttimer(i)<=0
hide object 7500+i
else
rttimer(i)=rttimer(i)-1
endif
next i
endfunction

That's it. You may have to play with the size of your thrust objects and the speed of the rocket to make it look good.