It's really the same suggestion as SSwift :
Thought it would look better than that though.
Graphics 640,480 SeedRnd MilliSecs() 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%, size% '---------------------------------------- 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) size = Rand(2,8) ListAddLast( list,Self ) End Method '---------------------------------------- Method draw() SetHandle size/2,size/2 SetScale 1.0,1.0 SetBlend maskblend SetAlpha 1.0 SetColor( r,g,b ) DrawOval x,y,size,size myrnd:Float=Rnd(0.8,1.4) SetScale myrnd,myrnd SetBlend lightblend SetAlpha rnd(0.2,0.8) DrawOval x,y,size,size End Method '---------------------------------------- Method update() End Method '---------------------------------------- Function generate() For star% = 1 To 1000 New TStar.Create() Next End Function End Type
Thought it would look better than that though.