I've applied your 2d-Particle functions on a quite needy standard of rocket incandescence. P'raps you might be able to pep up my meddly coding. As another hint: Try to make the particles you create more independent from each other.
I'll try to clean up my derivation of yours, rounding up some half-bugs and inconvenient side-effects...
'HOPE I HELPED:
Here's my suggestion:
`DBPRO 6.2
sync on
type ParticI
x as float
y as float
Grav as float
xs as float
ys as float
SN as integer
Life as integer
xr as float
yr as float
endtype
SMOKE as integer = 1
S_FLAKE as integer = 2
FLAME as integer = 3
hide mouse
Dim PartI(-1) as ParticI
load image "smoke.png", SMOKE
sprite SMOKE,0,0,SMOKE
set sprite alpha SMOKE,25 `add a little more transparency to this
load image "S_Flake.png", S_FLAKE
sprite S_FLAKE,0,0,S_FLAKE
load image "flame.png", FLAME
sprite FLAME, 0,0,FLAME
firex as float : firey as float
firex = screen width()/2
firey = screen height()/2
maxspeed=5
broaden=20
line 0,24,12,0
line 24,24,12,0
line 0,24,12,20
line 12,20,24,24
get image 7,0,0,24,24
set sprite 4,0,1
do
cls 0
`comment all but one of these or it will run very slow
Make2dParticles(screen width() / 2,screen height(), 0,2, -.4, -1,.4, -1, SMOKE,300, 1, 0)
Make2dParticles(screen width() / 2, -350, 0,1, -.4, .5,.4, .5, S_FLAKE,-1, 1,0)
Make2dParticles(firex,firey, 0,speed#, sin(angle#+rnd(broaden)-broaden*2)*speed#*0.5, cos(angle#+rnd(broaden)-broaden*2)*speed#*0.5, speedx#, speedy#, FLAME,150, 1,.2)
if upkey() and speed#<maxspeed then speed#=speed#+0.25
if downkey() and speed#>0 then speed#=speed#-0.25
if rightkey()=1 and rot#<2 then rot#=rot#+0.2
if leftkey()=1 and rot#>-2 then rot#=rot#-0.2
if rightkey()=0 and leftkey()=0
rot#=0
endif
set cursor 0,100
print "[",firex,"|",firey,"]"
print "Speed: ", speed#
print "Angle: ", angle#
line mousex(),mousey(),mousex()-sin(angle#)*10,mousey()-cos(angle#)*10
show sprite 4
offset sprite 4,sprite width(4)/2,sprite height(4)/2
sprite 4,firex,firey,7
rotate sprite 4,-angle#
angle#=wrapvalue(angle#-rot#)
if firex>0 and firex<screen width()
speedx#=sin(angle#)*speed#
else
firex=screen width()/2
endif
if firey>0 and firey<screen height()
speedy#=cos(angle#)*speed#
else
firey=screen height()/2
endif
firex=firex-speedx#
firey=firey-speedy#
Update2dParticles(0,-400,screen width(),screen height())
Show2dParticles()
text 0,0,"Number of particles:"+str$(array count(PartI()))
text 400,400,"FPS="+str$(screen fps())
sync
loop
Function MakeRectIm(ImNum as integer, Width as integer, Height as integer, Color as Dword)
create bitmap 32, Width, Height
ink Color, 0
box 0,0,Width, Height
get image ImNum, 0,0, Width, Height, 3
delete bitmap 32
endfunction
Function Make2dParticles(x as integer,y as integer,Grav as float, Am as word,xlp as float,ylp as float,xhp as float,yhp as float,SN as integer,Life as integer,xr as float, yr as float)
op = array count(PartI()) + 1
array insert at bottom PartI(), Am
np = array count(PartI())
offset sprite SN, sprite width(SN) / 2, sprite height(SN) / 2
hide sprite SN
for i = op to np
PartI(i).x = x
PartI(i).y = y
PartI(i).Grav = Grav
PartI(i).xs = (rnd((xhp * 100)-(xlp * 100))+(xlp * 100)) / 100
PartI(i).ys = (rnd((yhp*100)-(ylp*100)) + (ylp * 100)) / 100
PartI(i).SN = SN
PartI(i).Life = Life
PartI(i).xr = xr
PartI(i).yr = yr
next i
endfunction
FUNCTION Show2dParticles()
for i = 0 to array count(PartI())
set sprite alpha partI(i).SN, wrapvalue(partI(i).Life)*0.708
if partI(i).SN=3
set sprite diffuse partI(i).SN, 255,sqrt(wrapvalue(partI(i).Life)*18^2),wrapvalue(partI(i).Life)*0.708
endif
Paste sprite PartI(i).SN,PartI(i).x-sprite width(PartI(i).SN)/2,PartI(i).y-sprite height(PartI(i).SN)/2
next i
ENDFUNCTION
FUNCTION Update2dParticles(Left, Top, Right, Bot)
For i = 0 to array count(PartI())
if i <= array count(PartI())
del = 0
inc PartI(i).x, (rnd((PartI(i).xr*2))-PartI(i).xr)
inc PartI(i).y, (rnd((PartI(i).yr*2))-PartI(i).yr)
inc PartI(i).x, PartI(i).xs
inc PartI(i).y, PartI(i).ys
inc PartI(i).ys,PartI(i).grav
if PartI(i).x < Left or PartI(i).x > right or PartI(i).y < Top or PartI(i).y > Bot
array delete element PartI(), i
del = 1
endif
if del <> 1
if PartI(i).Life > -1
dec PartI(i).Life
if PartI(i).Life = 0
array delete element PartI(), i
endif
endif
endif
endif
next
ENDFUNCTION
FUNCTION XShift2dParticles(xamount as integer)
for i = 0 to array count(PartI())
inc PartI(i).x, xamount
next i
endfunction
FUNCTION YShift2dParticles(yamount as integer)
for i = 0 to array count(PartI())
inc PartI(i).y, yamount
next i
endfunction
Wherever you plan to go,
it's the next step you never know.