I modified your code for 2 planes each particle and added an extra setup function. The 2 planes are combined into 1 object which the rain is cloned off of.
The parameters are size# and image number to texture the planes (use either tga or png for transparent rain drops)
It returns the object number of the base object which is passed to the draw rain function which clones the base object.
function SetupRain(size#,img)
obj=1
while object exist(obj)
inc obj
endwhile
make object plane obj,size#,size#
make object plane obj+1,size#,size#
scale object obj,100,300,100
rotate object obj+1,0,90,0
make mesh from object 1,obj+1
add limb obj,1,1
delete object obj+1
texture object obj,img
set object transparency obj,1
endfunction obj
draw_rain takes these parameters
obj start, obj end, base object to clone, size, area x,y,z,ceiling, ground
function draw_rain(objstart,objend,base,size#,area#,x#,y#,z#,ceiling#,ground#)
for r=objstart to objend
if object exist(r)=0
clone object r,base
set object light r,0
position object r,x#+rnd(area#)-(area#/2),y#+rnd(ceiling#-ground#),z#+rnd(area#)-(area#/2)
endif
move object down r,size#*5
if object position y(r)<ground#
position object r,x#+rnd(area#)-(area#/2),ceiling#,z#+rnd(area#)-(area#/2)
endif
next
endfunction
Test Code:
(attached the png you need to run this code.)
set display mode 1024,768,32
sync on
sync rate 60
autocam off
load image "rain.png",1
base=SetupRain(0.1,1)
do
show object base
draw_rain(3,50,base,0.1,10,0,0,0,10,0)
hide object base
rotate camera Player,camera angle x(Player)+(mousemovey()/2),camera angle y(Player)+(mousemovex()/2.0),0
If keystate(17)=1 then move camera player,0.1
If keystate(31)=1 then move camera player,-0.1
If keystate(30)=1
Yrotate camera Player,Camera angle Y(Player)-90
Move camera player,0.1
Yrotate camera Player,Camera angle Y(Player)+90
endif
If keystate(32)=1
Yrotate camera Player,Camera angle Y(Player)+90
Move camera player,0.1
Yrotate camera Player,Camera angle Y(Player)-90
endif
if wrapvalue(camera angle x(Player))>40 and wrapvalue(camera angle x(Player))<180 then xrotate camera Player,40
if wrapvalue(camera angle x(Player))>180 and wrapvalue(camera angle x(Player))<280 then xrotate camera Player,280
position camera Player,camera position X(Player),camera position Y(Player)-FallVelocity#,camera position Z(Player)
sync
loop
function SetupRain(size#,img)
obj=1
while object exist(obj)
inc obj
endwhile
make object plane obj,size#,size#
make object plane obj+1,size#,size#
scale object obj,100,300,100
rotate object obj+1,0,90,0
make mesh from object 1,obj+1
add limb obj,1,1
delete object obj+1
texture object obj,img
set object transparency obj,1
endfunction obj
function draw_rain(objstart,objend,base,size#,area#,x#,y#,z#,ceiling#,ground#)
for r=objstart to objend
if object exist(r)=0 clone object r,base
set object light r,0
position object r,x#+rnd(area#)-(area#/2),y#+rnd(ceiling#-ground#),z#+rnd(area#)-(area#/2)
endif
move object down r,size#*5
if object position y(r)<ground#
position object r,x#+rnd(area#)-(area#/2),ceiling#,z#+rnd(area#)-(area#/2)
endif
next
endfunction
If it hasn't exploded yet, I haven't touched it.