Particle System by Anonymous Coder15th Mar 2006 10:55
|
---|
Summary Here is a particle system made in DarkBasic. Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com sync on sync rate 30 `Set background to black backdrop on color backdrop RGB(0,0,0) x#=0 z#=0 y#=0 a#=0 make object sphere 1,10 hide object 1 particles=400 `Create Particles for t=2 to particles+1 make object plain t,0.3,5 color object t,RGB(100,50,255) ghost object on t position object t,x#,y#+rnd(200),z# yrotate object t,180 move object t,-500 move object t,rnd(1000) point object t,object position x(1),object position y(t),object position z(1) yrotate object t,90 move object t,-250 move object t,rnd(500) next t `main loop Do `Update Particles for t=2 to particles+1 `Move particle down point object t,x#,object position y(t),z# position object t,object position x(t),object position y(t)-3,object position z(t) `Check and see if a particle has hit the ground if object position y(t)<=object position y(1)-100 y#=camera position y() x#=camera position x() z#=camera position z() a#=object angle y(1) position object t,x#,y#+rnd(200),z# yrotate object t,180 move object t,-500 move object t,rnd(1000) yrotate object t,90 move object t,-250 move object t,rnd(500) endif next t y#=camera position y() x#=camera position x() z#=camera position z() a#=object angle y(1) `User Interaction if leftkey()=1 a#=wrapvalue(a#-0.5) endif if rightkey()=1 a#=wrapvalue(a#+0.5) endif if upkey()=1 x#=newxvalue(x#,a#,1) z#=newzvalue(z#,a#,1) endif if downkey()=1 x#=newxvalue(x#,a#,-1) z#=newzvalue(z#,a#,-1) endif `Update Camera yrotate object 1,a# position object 1,x#,y#,z# yrotate camera object angle y(1) position camera object position x(1),object position y(1),object position z(1) `Syncronize the screen sync Loop |