TGC Codebase Backup



2D Snow Effect by Richard Davey

14th Sep 2003 9:42
Summary

A nice resolution independant 2D snow effect. Change the snow value for more or less flakes.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `	------------------------------------------------------------------------
`	2D Snow Effect                              DarkForge Snippet (6/8/2000)
`	------------------------------------------------------------------------
`
`	A nice resolution independant 2D snow effect.
`	Change the snow value for more/less flakes.

sync rate 0
sync on
hide mouse

snow=250

dim sx(snow)
dim sy(snow)

for t=0 to snow
	sx(t)=rnd(screen width())
	sy(t)=rnd(screen height()-1)
next t

do

	for t=0 to snow

		if sy(t)=screen height()-1 then sy(t)=0

		v=rnd(15)+1

		ink rgb(0,0,0),1
		dot sx(t),sy(t)

		if v<6 then sx(t)=sx(t)+1
		if v>10 then sx(t)=sx(t)-1

		sy(t)=sy(t)+1

		if sy(t)>screen height()-1 then sy(t)=screen height()

		ink rgb(255,255,255),1
		dot sx(t),sy(t)

	next t

	sync

loop