Something old...

Miscellaneous Forums/Blitz Showcase/Something old...

Found this on my hard disk whilst clearing out old stuff... It was the first thing I wrote after finding out how types work! So as you might expect, a few years old now! Actually looking at the write_rgb function, I'd guess at least 4 years old!

Anyway... Thought it was quite pretty!

Graphics 640,480,32,1
SetBuffer BackBuffer()

Type particle
	Field x#
	Field y#
	
	Field oldx#
	Field oldy#
	
	Field xd#
	Field yd#
	
	Field r
	Field g
	Field b
	
	Field life
End Type

SeedRnd MilliSecs ()

max=20000
max_life=1500
flow=0
size=1

my=-161

s#=0

spawnx=Rand(0,639)
spawny=0
spawnspread#=50
screen=CreateImage(640,640)


Repeat

;movey=MouseYSpeed()

;my=my+movey

;If my>0 Then my=0
;If my<-161 Then my=-161

Origin 0,my

spawnx=Rand(0,639)
spawny=0
spawnspread#=.5

For update=1 To 1
balls=0
For active.particle = Each particle

	active\yd=active\yd+.01 ;gravity
	active\xd=active\xd*.999
	active\yd=active\yd*.999
	del=False
	If active\life=0 Then del=True
	If active\x<0 Then active\x=639
	If active\x>639 Then active\x=0
	If active\y>639 Then active\y=639:active\yd=-(active\yd * Rnd(.1,.3))
	
	tmp=active\x
	If active\y>tmp+270 And active\x<200 And active\y<480
		active\yd=-(active\yd * Rnd(.1,.3))
		active\y=tmp+270
		active\xd=active\xd+.2
	EndIf
	
	tmp=639-active\x
	If active\y>tmp+270 And active\x>439 And active\y<480
		active\yd=-(active\yd * Rnd(.1,.3))
		active\y=tmp+270
		active\xd=active\xd-.2
	EndIf
		
	active\x=active\x+active\xd
	active\y=active\y+active\yd
	active\life=active\life-1

	If del=True Then Delete active
	
	balls=balls+1
	
Next

s=s+.1
If s>=360 Then s=0

If balls>max-flow Then flow=flow-1
If balls<max-flow Then flow=flow+1
If balls<max-flow
	For n=1 To flow
		p.particle = New particle
		p\x=spawnx
		p\y=spawny
		p\xd=Rnd(-spawnspread,spawnspread);Rnd(-.1+(Sin(s)*1),.1+(Sin(s)*1))
		p\yd=0+Rnd(0,.5);Rnd(-2,-1)
		p\life=Rand(max_life/2,max_life)
		
		If Rand(1,10) = 1 Then
			p\r = 255
			p\g = 255
			p\b = 255
		Else
			p\r=Rand(150,200)
			p\g=Rand(180,230)
			p\b=Rand(200,255)
		EndIf
	Next
EndIf

Next


; render screen
LockBuffer ImageBuffer(screen)
For active.particle = Each particle
	If active\y>-1 And active\y<641
		write_rgb(screen,active\oldx,active\oldy,0,0,0)
		write_rgb(screen,active\x,active\y,active\r*(Float(active\life)/max_life),active\g*(Float(active\life)/max_life),active\b*(Float(active\life)/max_life))
		active\oldx=active\x
		active\oldy=active\y
	EndIf
Next
UnlockBuffer ImageBuffer(screen)

DrawBlock screen,0,0
Color 255,255,0
Line 200,470+(size/2),0,270+(size/2)
Line 439,470+(size/2),639,270+(size/2)
Color 255,0,0
Line 0,640,639,640


Flip
Until KeyHit(1)

Function write_rgb(image_name,x,y,red,green,blue)
If x<0 Or x>ImageWidth(image_name)-1 Or y<0 Or y>ImageHeight(image_name)-1 Then Return

argb=(blue Or (green Shl 8) Or (red Shl 16) Or ($ff000000))
WritePixelFast x,y,argb,ImageBuffer(image_name)
End Function


This is exciting.

Thats just simply cool

Nice, seems like a waterfall.

I think it was supposed to look like rain and a funnel... or something... I vaguely remember thinking I could make animated sprites with it, then it got far too complex to actually make it loop... still... not to worry!

Amazing!
It could be used as a related intro with some screen fade effects