Hey, this is a particle function that I made, I didn't like using that DB example "Particle Bombs" all the time, so I decided to make the function better so you can make lots of types of particles.. it doesn't support texturing, but remember, this isn't an application, you can texture the particles yourselves
`**Particle Plugin**
`Settings------------------
`{
particles=50
life=20
emx#=0
emy#=0
emz#=0
Velx#=0
Vely#=-1
Velz#=0
intensityx#=50
intensityy#=50
intensityz#=50
Frictionx#=0.95
Frictiony#=0.95
Frictionz#=0.95
rotx#=1.0
roty#=1.0
rotz#=1.0
scalex#=100
scaley#=100
scalez#=0.1
rotate=1
camera=0
ghost=0
`}
`---------------------------
`Setup
hide mouse
Center text screen width()/2,screen height()/2,"Loading..."
sync on : sync rate 0
backdrop on : color backdrop 0
`Arrays
dim particles(1) : particles(1)=particles
dim particlex#(particles)
dim particley#(particles)
dim particlez#(particles)
dim particlexvel#(particles)
dim particleyvel#(particles)
dim particlezvel#(particles)
dim particleangx#(particles)
dim particleangy#(particles)
dim particleangz#(particles)
dim particlelife(particles)
for p=1 to particles(1)
particlex#(p)=emx#
particley#(p)=emy#
particlez#(p)=emz#
next p
`--Create Particles--
for t=1 to particles(1)
make object cube t,100
`set object rotation zyx t
hide object t
next t
`world
make matrix 1,1000,1000,5,5
position matrix 1,-500,0-(scaley#/2),-500
out#=-1000
`))Main loop((
do
inc vely#,0.0001
`Control particles
particle(emx#,emy#,emz#,particles(1),intensityx#,intensityy#,intensityz#,life,scalex#,scaley#,scalez#)
`[This keeps the particles working]
control_particle(velx#,vely#,velz#,frictionx#,frictiony#,frictionz#,rotx#,roty#,rotz#,rotate,camera,ghost)
`Simple Controls
if leftkey()=1 then a#=wrapvalue(a#+3.0)
if rightkey()=1 then a#=wrapvalue(a#-3.0)
if upkey()=1 then inc out#,3
if downkey()=1 then dec out#,3
ca#=wrapvalue(curveangle(a#,ca#,20.0))
cx#=newxvalue(emx#,ca#,out#)
cz#=newzvalue(emz#,ca#,out#)
cy#=200
position camera cx#,cy#,cz#
point camera emx#,0,emz#
`))End Loop((
sync
loop
`**Particles**
function particle(px#,py#,pz#,particles,intx#,inty#,intz#,life,sclx#,scly#,sclz#)
t=0:p=0
repeat
t=t+1
if particlelife(t)=0
p=p+1
particlelife(t)=life + rnd(life/5)
particlex#(t)=px#
particley#(t)=py#
particlez#(t)=pz#
particlexvel#(t)=rnd(intx#)-(intx#/2)
particleyvel#(t)=rnd(inty#)-(inty#/2)
particlezvel#(t)=rnd(intz#)-(intz#/2)
show object t
scale object t,sclx#,scly#,sclz#
endif
if p>=particles then exit
until t>=particles(1)
endfunction
Function Control_Particle(velx#,vely#,velz#,fricx#,fricy#,fricz#,rotx#,roty#,rotz#,rot,cam,ghost)
for t=1 to particles(1)
if particlelife(t)>1
particlelife(t) = particlelife(t) - 1
position object t,particlex#(t),particley#(t),particlez#(t)
particlexvel#(t)=particlexvel#(t)*fricx#
particleyvel#(t)=particleyvel#(t)*fricy#
particlezvel#(t)=particlezvel#(t)*fricz#
particlexvel#(t)=particlexvel#(t)-velx#
particleyvel#(t)=particleyvel#(t)-vely#
particlezvel#(t)=particlezvel#(t)-velz#
particlex#(t) = particlex#(t) + particlexvel#(t)
particley#(t) = particley#(t) + particleyvel#(t)
particlez#(t) = particlez#(t) + particlezvel#(t)
`if particley#(t)<=0 then particlelife(t)=0
if cam=1 and rot=1
particleangx#(t)=camera angle x()
particleangy#(t)=camera angle y()
particleangz#(t)=wrapvalue(object angle z(t)+rotz#+rnd(particleangx#(t)/5))
endif
if cam=1 and rot=0
particleangx#(t)=camera angle x()
particleangy#(t)=camera angle y()
particleangz#(t)=0
endif
if cam=0 and rot=1
particleangx#(t)=wrapvalue(object angle x(t)+rotx#+rnd(particleangx#(t)/5))
particleangy#(t)=wrapvalue(object angle y(t)+roty#+rnd(particleangy#(t)/5))
particleangz#(t)=wrapvalue(object angle z(t)+rotz#+rnd(particleangz#(t)/5))
endif
if cam=0 and rot=0
particleangx#(t)=0
particleangy#(t)=0
particleangz#(t)=0
endif
rotate object t,particleangx#(t),particleangy#(t),particleangz#(t)
if ghost=1 then ghost object on t else ghost object off t
endif
if particlelife(t)=1
particlelife(t)=0
hide object t
endif
next t
endfunction
Note: The Settings part (at the top) has all the variables you need, which means I can make presets, which I shall be posting in a second
[Edit]
Ok, preset 1, a comet tail kinda thing (I know, its crap)
particles=50
life=40
emx#=0
emy#=0
emz#=0
Velx#=-01
Vely#=-01
Velz#=-01
intensityx#=2
intensityy#=2
intensityz#=2
Frictionx#=0.95
Frictiony#=0.95
Frictionz#=0.95
rotx#=10.0
roty#=10.0
rotz#=10.0
scalex#=100
scaley#=100
scalez#=0.1
rotate=1
camera=1
ghost=1
preset 2 - snow
particles=200
life=500
emx#=0
emy#=800
emz#=0
Velx#=0
Vely#=0.1
Velz#=0
intensityx#=25
intensityy#=5
intensityz#=25
Frictionx#=0.99
Frictiony#=0.99
Frictionz#=0.99
rotx#=1.0
roty#=1.0
rotz#=1.0
scalex#=10
scaley#=10
scalez#=0.1
rotate=1
camera=1
ghost=1
preset 3 - rain
particles=200
life=500
emx#=0
emy#=800
emz#=0
Velx#=0
Vely#=0.9
Velz#=0
intensityx#=45
intensityy#=20
intensityz#=45
Frictionx#=0.99
Frictiony#=0.99
Frictionz#=0.99
rotx#=1.0
roty#=1.0
rotz#=1.0
scalex#=5
scaley#=20
scalez#=0.1
rotate=0
camera=1
ghost=1
preset 4 - electricity
particles=50
life=500
emx#=0
emy#=0
emz#=0
Velx#=0
Vely#=0.9
Velz#=0
intensityx#=15
intensityy#=15
intensityz#=15
Frictionx#=0.99
Frictiony#=0.99
Frictionz#=0.99
rotx#=1.0
roty#=1.0
rotz#=1.0
scalex#=200
scaley#=200
scalez#=0.1
rotate=1
camera=0
ghost=1
Preset 5 - explosion
particles=50
life=100
emx#=0
emy#=0
emz#=0
Velx#=0
Vely#=0.5
Velz#=0
intensityx#=80
intensityy#=80
intensityz#=80
Frictionx#=0.95
Frictiony#=0.95
Frictionz#=0.95
rotx#=1.0
roty#=1.0
rotz#=1.0
scalex#=20
scaley#=20
scalez#=0.1
rotate=1
camera=0
ghost=1
Note: you can use the left and right arrow keys to spin round the place