TGC Codebase Backup



Snow Effect by Xzi

11th Jan 2004 10:30
Summary

A drifting snow effect.



Description

A drifting snow effect. If you are going to use this in a creation please put Xzi Enterprises in the credits for the effect.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    remstart
XZI ENTERPRISES
Xzi Enterprises Snow Effect
remend


sync on : backdrop on : color backdrop rgb(0,0,0) : hide mouse
weatherx=640 : weathery=480 : weatherfq=800
rem snow
if file exist("SNOWpos.WDF")=1 then delete file "SNOWpos.WDF"
open to write 1,"SNOWpos.WDF"
for t=1 to weatherfq
a=rnd(weatherx) : b=rnd(weathery)
write file 1,a : write file 1,b
next t
close file 1

rem do, loop
do
rem snow
d=d+1
	if d<>2
	open to read 1,"SNOWpos.WDF"
	for t=1 to weatherfq
	read file 1,a : read file 1,b
	dot a,b
	next t
	close file 1
	endif

	if d=2
	if file exist("SNOWpos.WDF2")=1 then delete file "SNOWpos.WDF2"
	open to read 1,"SNOWpos.WDF" : open to write 2,"SNOWpos.WDF2"
	for t=1 to weatherfq
	ink rgb(200+rnd(55),200+rnd(55),200+rnd(55)),1
	read file 1,a : read file 1,b : c=rnd(4)
		if c=1 then c=-2
		if c=2 then c=-1
		if c=3 then c=1
			if c=4 then c=2
		if b>weathery then b=-2
	dot a+c,b+2
	write file 2,a+c : write file 2,b+2
	next t : close file 1 : close file 2 : delete file "SNOWpos.WDF" : rename file "SNOWpos.WDF2","SNOWpos.WDF"
	d=0 : endif
SYNC
loop