particle candy question - trails behind rockets

Blitz3D Forums/Blitz3D Programming/particle candy question - trails behind rockets

ryan scott(Posted 2004) [#1]
in my game i'm launching multiple rockets quickly in sequence, and i want smoke trails coming from them.

ROCKETSMOKE=createemitter_smoke()
Emitter_SetScale ROCKETSMOKE,2.1

sets up one emitter

is there a way to use this one emitter to make smoke from multiple rockets?

i am now creating an emitter for each bullet, 200 of them at initialization(yes it slows things down to do this). if i don't do this, i get only one trail, from the last rocket shot.

is there any way to simply reference a existing emitter with another name instead of doing a whole new create, so that it doesn't balloon my software?


IPete2(Posted 2004) [#2]
Ryan,

Checkout the meteor demo code in the code samples folder. That does a similar job, maybe you can findout how the author applied multiple trails in that code.

IPete2.


Idaho Razor(Posted 2004) [#3]
1. i wouldn't have 200 bullets load up from the beginning, the way i did it in my game was to have each bullet created when the player hit control and deleted when the bullet reached a certain distance....

2. To get the particles you wanted, create another bb file... From there code a function that'll declare the x y and z axis of that particle and will also load the sprite... ie:
CreateParticle(x#,y#,z#,sprite$)
p.particle = new particle
p\x = x#
p\y = y#
p\z = z#
p\image = sprite$

p\sprite = loadsprite(p\image)
scalesprite p\sprite,0.2,0.2
positionentity p\sprite,0,0,5
end function

after you have your function that creates the particle make a function that will update the movement constantly, also have the update function delete the particle when it reaches a certain point constantly

Function updateparticle()
For p.particle = Each particle
p\zmove# = p\zmove# - 0.1
PositionEntity p\sp,p\xpos,p\ypos,p\zpos
MoveEntity p\sp,0,0,p\zmove#
If p\zmove# <= -0.75
FreeEntity p\sp
Delete p
EndIf
Next
End Function

then run these in your main bb code...

here is a very early screen shot of my game using these exact particles (http://www.razor.together4eva.com/S3D/UpdateL.jpg)
of course using the CreateParticle function i added some small rnd(-0.2,0.2)+entityx(bullet) on each x y and z axis to get the more fire trail effect... (else it'll be straight and not fire trail like)

if you still don't know what to do i'll be releasing a very simple lib out soon when i finish my game... or you can check out candy factory (main site)

Hope this helps! and good luck with your project!