Improved Starfield !!

BlitzMax Forums/BlitzMax Programming/Improved Starfield !!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm trying to get a starfield background to look a little more interesting. Can anyone suggest a way to make them twinkle, or glow, or something that might look better? (and yes, i know stars don't twinkle in space).

In the example below; stars are game objects of a random colour simply plotted to the screen.

Any idea's?

Graphics 640,480

Tstar.generate()

While Not AppTerminate() And Not KeyHit(KEY_ESCAPE)
	TGameObject.updateall() 
	TGameObject.drawall( True )
Wend

Type TGameObject
	Global list:TList = CreateList()
	Field x#,y#
	Field r% , g% , b%
	'----------------------------------------
	Method draw() 
	End Method
	'----------------------------------------
	Method update()
	End Method
	'----------------------------------------
	Function drawAll( clear% = False )
		If clear Then Cls
		For item:TGameObject = EachIn list
			item.draw() 
		Next
		Flip
	End Function
	'----------------------------------------
	Function updateAll() 
		For item:TGameObject = EachIn list
			item.update() 
		Next
	End Function
End Type

Type TStar Extends TGameObject
	'----------------------------------------
	Method Create:TStar() 
		x = Rand( 0, GraphicsWidth() )
		y = Rand( 0, GraphicsHeight() ) 
		r = Rand(128 , 255)
		g = Rand(128 , 255) 
		b = Rand(128 , 255)
		ListAddLast( list,Self )
	End Method
	'----------------------------------------
	Method draw() 
		SetColor( r,g,b )
		Plot( x,y )
	End Method
	'----------------------------------------
	Method update()
	End Method
	'----------------------------------------
	Function generate()
		For star% = 1 To 1000
			New TStar.Create() 
		Next
	End Function
End Type