depends, each emmitter can have a maximum of 1000 particles, you can specify this number in the make_particles command, the fire demo has 200 particles.
and they use object numbers 3000000 and over, not sure how many people would use those
[edit] for those of you who are too lazy to install the sparkys collision ive removed the collision code in this one
Rem Project: Particles
Rem Created: 10/28/04 12:01:38 PM
Rem ***** Main Source File *****
sync on
`color backdrop rgb(0,0,0)
start_particles()
`position object 1,0,-10,0
`make_particles(1,200,10.0,2,"fire.bmp",0,0)
`set_particles(1,0,0.9,0.01,0.3,0.3)
make_particles(1,200,15.0,2,"fire.bmp",0,90)
`set_particles(1,0.09,2,0.05,0.05,0)
particles_gravity(1,0.05)
particles_life(1,2)
particles_per_sec(1,0.08)
particles_force(1,0.0)
particles_chaos(1,0.02)
rotate_particles(1,0,0,0)
`=== This is just to optimize it really, 1 means the particles
`=== alpha will change every frame, 10 means the particles
`=== alpha will change every 10 frames.
particles_delay(1,5)
move camera -100
do
text 0,0,str$(screen fps())
run_particles()
sync
loop
function start_particles()
dim Particles(255,1000,10) as float
dim emmitters(255,25) as float
dim time(10) as dword : time(0)=0
dim collision(1000)
time(10)=3000000
make object plain time(10)-1,0,0
endfunction
function add_particles_collider(No)
collision(0)=collision(0)+1
collision(collision(0))=No
`setupcomplexobject No,0,2
`allowobjectscaling No
endfunction
function set_particle_collision(No,Style)
emmitters(No,16)=Style
`1 = hit and stop
`2 = hit and bounce
endfunction
function make_particles(No,Ammount,Size#,Style,Tex as string,Light,Die)
if particles_exist(No)=1 then exit prompt "Particles already exist","Error" : end
if No<1 or No>255 then exit prompt "Particles out of bounds (1-255)","Error" : end
if Ammount<1 or Ammount>999 then exit prompt "Particles Count out of bounds (1-1000)","Error" : end
Num=time(10)+No*1001
if Style=2 then load image tex,No+time(10)
for i=Num to Num+Ammount
if Style=1
make object plain i,Size#,Size#/10
xrotate object i,90
yrotate object i,90
fix object pivot i
endif
if Style=2 then make object plain i,size#,size# : texture object i,No+time(10) :` ghost object on i
if Die>0 then ghost object on i
`if Light=0 then set object light i,0
set object cull i,0
position object i,0,-99999999,0
disable object zwrite i
next i
emmitters(No,0)=1
emmitters(No,1)=Ammount
emmitters(No,4)=Style
emmitters(No,12)=Die
emmitters(No,14)=1
endfunction
function particles_gravity(No,Gravity#)
emmitters(No,7)=Gravity#
endfunction
function particles_life(No,Life#)
emmitters(No,8)=Life#
endfunction
function particles_per_sec(No,Count#)
emmitters(No,9)=Count#
endfunction
function particles_force(No,Force#)
emmitters(No,11)=Force#
endfunction
function particles_chaos(No,Chaos#)
emmitters(No,10)=Chaos#
endfunction
function particles_delay(No,D#)
emmitters(No,15)=D#
endfunction
function rotate_particles(No,x#,y#,z#)
position object time(10)-1,0,0,0
rotate object time(10)-1,x#,y#,z#
move object time(10)-1,1
emmitters(No,21)=opx(time(10)-1)
emmitters(No,22)=opy(time(10)-1)
emmitters(No,23)=opz(time(10)-1)
endfunction
function position_particles(No,x#,y#,z#)
emmitters(No,17)=x#
emmitters(No,18)=y#
emmitters(No,19)=z#
endfunction
function run_particles()
time(1)=timer()
dif#=((time(1)-time(2))+time(3))/2
time(3)=dif#
dif#=dif#/1000
time(2)=time(1)
if time(0)=0 then dif#=0 : time(0)=1 : time(3)=1
for i=1 to 255
if emmitters(i,0)=1
Num=time(10)+i*1001
if emmitters(i,14)=1 then emmitters(i,13)=emmitters(i,13)+dif# :` emmitters spawn
r=0
for p=Num to Num+emmitters(i,1)
r=r+1
if emmitters(i,13)>emmitters(i,9) and Particles(i,r,0)<0 then position object p,emmitters(i,17),emmitters(i,18),emmitters(i,19) : Particles(i,r,0)=emmitters(i,8)+(rnd(emmitters(i,8)/2)) : Particles(i,r,1)=emmitters(i,11)+rnd(emmitters(i,11)/10):emmitters(i,13)=emmitters(i,13)-emmitters(i,9):Particles(i,r,4)=(rnd(emmitters(i,10)*100000)-emmitters(i,10)*50000)/100000:Particles(i,r,5)=(rnd(emmitters(i,10)*100000)-emmitters(i,10)*50000)/100000:Particles(i,r,2)=0:Particles(i,r,3)=0:Particles(i,r,8)=0 : Particles(i,r,6)=emmitters(i,7):fade object p,100 :`reset
Particles(i,r,0)=Particles(i,r,0)-dif# :` life
Particles(i,r,1)=Particles(i,r,1)+(particles(i,r,6)*dif#) :` height
Particles(i,r,2)=Particles(i,r,2)+Particles(i,r,4)
Particles(i,r,3)=Particles(i,r,3)+Particles(i,r,5)
ox#=opx(p):oy#=opy(p):oz#=opz(p)
if Particles(i,r,8)=0 then position object p,opx(p)+Particles(i,r,2)*dif#,opy(p)+Particles(i,r,1),opz(p)+Particles(i,r,3)*dif#
if emmitters(i,4)=1
point object p,ox#,oy#,oz#
else
oax#=object angle x(p)
oay#=object angle y(p)
oaz#=object angle z(p)
point object p,camera position x(),camera position y(),camera position z()
`rotate object p,(object angle x(p)+oax#)/2,(object angle y(p)+oay#)/2,(object angle z(p)+oaz#)/2
endif
if emmitters(i,16)>0
if collision(0)>0
for c=1 to collision(0)
`hit=intersectobject(collision(c),0,ox#,oy#,oz#,opx(p),opy(p),opz(p),0)
if hit=1
if emmitters(i,16)=1
`if emmitters(i,4)=1 then rotate object p,getcollisionnormalx(),getcollisionnormaly(),getcollisionnormalz()
`position object p,getstaticcollisionx(),getstaticcollisiony(),getstaticcollisionz()
Particles(i,r,1)=0 : Particles(i,r,2)=0 : Particles(i,r,3)=0
Particles(i,r,4)=0 : Particles(i,r,5)=0
Particles(i,r,8)=1 : particles(i,r,6)=0
endif
if emmitters(i,16)=2
Particles(i,r,1)=(0-Particles(i,r,1))/2
Particles(i,r,2)=Particles(i,r,2)/2 : Particles(i,r,3)=Particles(i,r,3)/2
Particles(i,r,4)=Particles(i,r,4)/2 : Particles(i,r,5)=Particles(i,r,5)/2
endif
endif
next c
endif
endif
alpha=100
if Particles(i,r,0)<0 then position object p,0,-99999999,0
s1#=emmitters(i,8)-(emmitters(i,12)/100)*emmitters(i,8)
if Particles(i,r,0)<s1#
alpha#=perc(Particles(i,r,0),s1#)
alpha=alpha#
endif
Particles(i,r,9)=Particles(i,r,9)-1
if Particles(i,r,9)<0
fade object p,alpha
Particles(i,r,9)=emmitters(i,15)
endif
next p
endif
next i
endfunction
function perc(val1#,val2#)
if val1#>0
answ#=(val1#/val2#)*100
else
answ#=0
endif
if answ#>100 then answ#=100
endfunction answ#
function particles_exist(No)
ex=emmitters(No,0)
endfunction ex
function opx(No)
res#=object position x(No)
endfunction res#
function opy(No)
res#=object position y(No)
endfunction res#
function opz(No)
res#=object position z(No)
endfunction res#
function fade(Percent#,Val1#,Val2#)
answ#=(val1#*Percent#)+((100-val1#)*Percent#)
endfunction answ#
function delete_particles(No)
for i=0 to 255
for o=0 to 1000
if object exist(o)=1 then delete object o
for p=0 to 10
Particles(i,o,p)=0
next p
next o
next i
for i=0 to 255
for o=0 to 20
emmitters(i,o)=0
next o
next i
endfunction
function stop_particles(No,Valu)
emmitters(No,14)=Valu
endfunction
delete memblock 1