@guruchild just shut up okay, thx
Okay I finished off the code for the distance stuff I have not tested it though
ohh can you change it so that the particles are formed off scene because at the moment i create them at the start of the level and they are all on screen
*edit* durr just hide them sorry guys
+ Code Snippet`Rain particle generator v2.0
`By Kentaree 19/05/03, last modification 03/07/03
`Code added and/or modified by Duncala
`http://members.lycos.co.uk/darknessrising/
`Setup program environment.
sync on
sync rate 60
autocam off
backdrop on
color backdrop rgb(0,0,0): `Remove this line if you're using DBPro
`Load media.
load image "rain.jpg", 1
`Maximum particle amount and currently shown amount
particleAmount=100
amountShown=50
maxDistance=300
`Set up an array holding position and speed of particles
dim rain(particleAmount,4)
xPos=0
yPos=1
zPos=2
speed=3
`Make all the particles
gosub _setupParticles
do
`Simple test controls, increase or decrease the amount of shown particles if possible
1X# = Object position x(1)
1Z# = Object position z(1)
2X# = Object position x(2)
2Z# = Object position z(2)
difX#=mX#-pX#
difZ#=mZ#-pZ#
diffX#=difX#*difX#
diffZ#=difZ#*difZ#
differ#=diffZ#+diffX#
distance#=sqrt(diff#)
if distance>50 then amountShown = 10
if distance<50 then amountShown = 20
if distance<40 then amountShown = 30
if distance<30 then amountShown = 40
if distance<20 then amountShown = 50
if distance<10 then amountShown = 60
randomize timer()
gosub _moveParticles
text 0,0,"Amount = "+str$(amountShown)
sync
loop
_setupParticles:
`Make textured and ghosted plains numbered 1 to 50, and set transparency on
for i=1 to particleAmount
make object plain i, 1,1
set object i,1,0,0
texture object i,1
ghost object on i
disable object zdepth i
lock object on i
`Setup array values for each particles holding the positional data
rain(i-1,zPos)=(int(rnd(maxDistance)+1))+20: `Z coordinate of particle
rain(i-1,xPos)=(int(rnd(rain(i-1,zPos)*.8)*2+1))-rain(i-1,zPos)*.8: `X coordinate of particle
rain(i-1,yPos)=(int(rnd(rain(i-1,zPos)*.6)*2+1)): `Y coordinate of particle
rain(i-1,speed)=(int(rnd(3)+1+(rain(i-1,zPos)*.6/50))): `Speed of particle
`Position object for start
position object i, rain(i-1,xPos), rain(i-1,yPos), rain(i-1,zPos)
if i>amountShown then hide object i
next i
return
_moveParticles:
for i=1 to particleAmount
if i<=amountShown
if object visible(i)=0 then show object 1
`Move particle down according to speed value, which makes a random effect
rain(i-1,yPos)=rain(i-1,yPos)-rain(i-1,speed)
`If particle goes too low, set new position
if rain(i-1,yPos)<-15
rain(i-1,zPos)=(int(rnd(500)+1))+20
rain(i-1,xPos)=(int(rnd(rain(i-1,zPos)*.8)*2+1))-rain(i-1,zPos)*.8
rain(i-1,yPos)=(int(rnd(rain(i-1,zPos)*.6)*2+1))
rain(i-1,speed)=(int(rnd(3)+1+(rain(i-1,zPos)*.6/50)))
endif
`Position particle
position object i, rain(i-1,xPos), rain(i-1,yPos), rain(i-1,zPos)
else
if object visible(i)=1 then hide object i
endif
next i
return
Okay it would be cool if one of you could test it for me
Ohh btw English is my fist language and if you read the post again I have edit and the reason why it was so bad was because I did it at about 4:00 in the morning just before I went to sleep okay next time I will try to look over it
Clear Coder
P.S I am going to edit the code i bit more to make it use sprites coz with all those poly if doesn't do well for the FPS on my PC.