ArcBasicDocs

tutorials/beginner

09_snow.abs

41 lines of ArcBasic. Words in colour that are commands link to their help page. To run it, download ArcBasic, open the file and press F5.

Download 09_snow.absAll files in this folder

09_snow.abs
; Types: lots of things, each with its own detailsGraphics 640, 480SetBuffer BackBuffer(); what every snowflake knows about itselfType Flake	Field x#, y#	Field speed#	Field sizeEnd TypeWhile Not KeyHit(1)	; a new flake or two every frame	For n = 1 To 2		f.Flake = New Flake		f\x = Rand(0, 639)		f\y = -5		f\speed = Rnd(1, 3)		f\size = Rand(2, 5)	Next	; move every flake, and get rid of the ones that have left the screen	For f.Flake = Each Flake		f\y = f\y + f\speed		f\x = f\x + Sin(f\y * 2)          ; drift from side to side		If f\y > 480 Then Delete f	Next	Cls	Color 255, 255, 255	count = 0	For f.Flake = Each Flake		Oval f\x, f\y, f\size, f\size		count = count + 1	Next	Text 10, 10, count + " snowflakes. Escape quits."	FlipWendEnd