(AGK version: 2017.2.28)
Submitted: 2017-03-23 11:48:18
rem
rem AGK Application 2017.02.28, Player 27 Feb 2017
rem MR

rem Snow Fall Example

SetVirtualResolution(100,100)

Type TPar
	x as float
	y as float
	speed as float
	size as float
EndType

global Snow as TPar[200]

img=0 //LoadImage("snow.png")
spr=CreateSprite(img)

for i=1 to 200
	SnowRenew(i)
	Snow[i].y = Random2(0,GetVirtualHeight())
next

Do

	for i=1 to 200
		SetSpritePositionByOffset(spr,Snow[i].x,Snow[i].y)
		SetSpriteSize(spr,-1,Snow[i].size)
		DrawSprite(spr)
		Snow[i].x = Snow[i].x + Rnd(-0.1,0.1)
		Snow[i].y = Snow[i].y + Snow[i].speed
		if Snow[i].y => GetVirtualHeight() then SnowRenew(i)
	next
	
	sync()
Loop

Function SnowRenew(i)
	
	Snow[i].size = Rnd(0.2,1)
	Snow[i].x = Rnd(0,GetVirtualWidth()) 
	Snow[i].y = -1
	Snow[i].speed = Rnd(25.0 / 60.0 , 50.0 / 60.0)
	
EndFunction 

Function Rnd(a as float,b as Float)
	
	c as float
	c = Random2(a*100,b*100)
	c = c / 100.0
	
EndFunction c



Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.