Posted: 28th Mar 2006 18:44
REM Project: tim6
REM Created: 3/22/2006 11:10:01 AM
REM
REM ***** Main Source File *****
sync on
sync rate 25
hide mouse
autocam off
position camera 0,5,0
color backdrop rgb(100,100,155)
fog on
fog color rgb(100,100,155)
fog distance 2000
`grass
for x=1 to 10
for y=1 to 10
ink rgb(rnd(100),rnd(155)+100,0),0
dot x,y
next y
next x
get image 1000,1,1,10,10
make object plain 1000,2000,2000
xrotate object 1000,-90
texture object 1000,1000
scale object texture 1000,10,10
set object texture 1000,2,0
`particle properties
numberofparticles=10000
dim x#(numberofparticles)
dim y#(numberofparticles)
dim xspeed#(numberofparticles)
dim yspeed#(numberofparticles)
dim brightness(numberofparticles)
dim a#(numberofparticles)
dim e#(numberofparticles) `phase angle
for particle=1 to numberofparticles
x#(particle)=rnd(screen width())
y#(particle)=rnd(screen height())
xspeed#(particle)=(rnd(3000)/1000.0)
e#(particle)=rnd(360)
brightness(particle)=rnd(100)+100
a#(particle)=gaussian(2*screen width())-screen width() `amplitude
gravitya#=.01
gravityb#=1.0
omega#=0.0006 `primary angular velocity
phi#=2.0 `secondary angular velocity
next particle
do
inc counter
if counter>1000 then counter=0
if counter=100 or counter=110 or counter=400
color backdrop rgb(255,255,255)
else
color backdrop rgb(100,100,155)
endif
gosub particles
control camera using arrowkeys 0,1,1
if counter/2.0=int(counter/2.0) then sync
loop
particles:
text 0,0,str$(screen fps())
lock pixels
`tornado particles
for particle=1 to numberofparticles step 2
inc y#(particle),gravityb#
if y#(particle)>0 and y#(particle)<screen height() and x#(particle)>0 and x#(particle)<screen width() then set_locked_pixel(x#(particle),y#(particle),rgb(brightness(particle),brightness(particle),200))
x#(particle)=(500/y#(particle)^1.5)*a#(particle)*sin(theta#+e#(particle))+screen width()/2+(20*sin(y#(particle)+psi#))
theta#=wrapvalue(theta#)+omega#
if y#(particle)>=screen height()/1.5 then dec y#(particle),screen height()
next particle
psi#=wrapvalue(psi#)+phi#
`background particles
for particle=2 to numberofparticles step 2
inc y#(particle),gravityb#
if y#(particle)>screen height()-1 then y#(particle)=1
if y#(particle)>0 and y#(particle)<screen height() and x#(particle)>0 and x#(particle)<screen width() then set_locked_pixel(x#(particle),y#(particle),rgb(brightness(particle),brightness(particle),200))
inc x#(particle),xspeed#(particle)
if x#(particle)>screen width()-1 then x#(particle)=1
next particle
unlock pixels
return
`Function borrowed from Coding Fodder's Rain code
function set_locked_pixel(x,y,color_value)
start=get pixels pointer()
repeat_number=get pixels pitch()
bits_per_pixel=bitmap depth(num)/8
pointer=start+y*repeat_number+x*bits_per_pixel
*pointer=color_value
endfunction
function gaussian(range#)
r=0
for a = 1 to range#/10
inc r, rnd(range#)
next a
r=int(10*r/range#)
endFunction r
rem load sound
load sound "sound\timetodie.wav",1
if soundnumber=1
play sound 1
endif
end
won't play sound can ya help