Okay open dbp and paste this code
sync rate 70
sync on
autocam off
color backdrop 0
` Setup
goSub vars
createobjs(Smokestart,Smokeend)
make matrix 1,1000,1000,10,10
position matrix 1,-500,0,-500
make object sphere 1,100 : hide object 1
make object sphere 2,100 : hide object 2
do
` Randomise
randomize timer()
` SIN roots
inc i,mousemovex()
` Position camera
position camera sin(i)*100,10,cos(i)*100
point camera 0,0,0
` Print FPS
text 10,10,str$(screen fps())
` Subroutines
goSub UpdateSmoke
goSub ControlSmoke
sync
loop
` Createobjs function
Function CreateObjs(start,_end)
` Load texture...
load image "smoke.bmp",1
for o = start to _end
make object plain o,20,20
texture object o,1
ghost object on o
hide object o
randomize timer()*o
set object fog o,0
texture object o,1 :`.. and texture particles
set object transparency o,1
next o
EndFunction
` Update trails function
UpdateSmoke:
Positioned = 0
for o = Smokestart to Smokeend
if object visible(o) = 0 and Positioned = 0
` Creates particle
show object o
position object o,object position x(FocusObj),object position y(FocusObj),object position z(FocusObj)
Positioned = 1
` Store info
Particles(o) = Timer()
` Increase SIN root - used for rotating particle
inc i2
` Rotate particle semi-randomly : SIN used for X axis to provide smooth rotation
zrotate object o,rnd(36)
yrotate object o,rnd(360*2)
xrotate object o,270+(sin(i2)*45)
` Store these angles - the particle must be facing camera when sync called, but for movement it must be facing its own direction
objangs#(o,1) = object angle x(o)
objangs#(o,2) = object angle y(o)
objangs#(o,3) = object angle z(o)
endif
next o
return
ControlSmoke:
for o = Smokestart to Smokeend
Diff = (Timer() - Particles(o))
if Diff > Timeout then hide object o
` Rotate particle to own angles
rotate object o,objangs#(o,1),objangs#(o,2),objangs#(o,3)
` Move
move object o,1
` Point at camera otherwise we get side on view of a flat plain (not nice)
set object to camera orientation o
next o
return
vars:
Smokestart = 20
Smokeend = 120
Timeout = 1000
FocusObj = 1
Rocketimg = 1
Dim Particles(Smokeend)
Dim ObjAngs#(Smokeend,3) : `Stores particle angles
return
and smoke.bmp:
now you will notice the variable focusobj - that is the object the dust / smoke will follow. Calling
controlsmoke will update the particles.
There's no place like 127.0.0.1
There are 10 people in this world, those who understand binary and those who don't.