Here ist also some old code in wich i tried to generate a Starfield:
This ist the Image
SuperStrict Rem Framework BRL.GLMax2D Import BRL.LinkedList Import BRL.Random EndRem Incbin "star.png" Type TStarfield Global Starlist:TList = New TList Global center_X:Double Global center_Y:Double Global x_home:Int Global y_home:Int Global height:Int Global width:Int Global accel:Double = 1.05 Global fade:Double = 1.05 Global max_age:Int = 500 Global image:TImage Field x:Double Field y:Double Field vx:Double Field vy:Double Field red:Int Field green:Int Field blue:Int Field age:Int Field inuse:Byte Method New() Self.Emit() ListAddLast(Starlist, Self) EndMethod Method Draw() If inuse > 0 Then Local oldBlend:Int = GetBlend() Local oldAlpha:Double = GetAlpha() Local oldMaskRED:Int Local oldMaskGREEN:Int Local oldMaskBLUE:Int GetMaskColor(oldMaskRED , oldMaskGREEN , oldMaskBLUE) SetMaskColor(0,0,0) SetBlend(ALPHABLEND) If age < max_age SetAlpha(1.0-Float(age)/Float(max_age)) Else SetAlpha(1.0) EndIf DrawImage(image , x , y) SetBlend oldBlend SetAlpha oldAlpha SetMaskColor(oldMaskRED , oldMaskGREEN , oldMaskBLUE) EndIf EndMethod Method Update() If inuse > 0 x :+ vx y :+ vy vx :* accel vy :* accel age :- 1 If age = 0 Then inuse = 0 If x < x_home Or x > (x_home + width) Then inuse = 0 If y < y_home Then inuse = 0 If y > (y_home + height) Then inuse = 0 Else Self.Emit() EndIf EndMethod Method Emit() vx = - .5 + RndDouble() vy = - .5 + RndDouble() x = Center_X y = Center_Y age = max_age inuse = 1 EndMethod Function UpdateAll() For Local s:TStarfield=EachIn Starlist s.Update() Next EndFunction Function DrawAll() For Local s:TStarfield=EachIn Starlist s.Draw() Next EndFunction Function SetAcceleration(acceleration:Double) accel = acceleration EndFunction Function EmitStars(amount:Int) For Local i:Int = 1 To amount Local temp:TStarfield = New TStarfield Next EndFunction Function SetCenter(in_x:Int , in_y:Int) center_X = in_x center_Y = in_y EndFunction Function SetFade(fade:Double) EndFunction Function SetImage(picture:TImage) image = picture EndFunction Function SetDimensions(x:Int , y:Int , w:Int , h:Int) x_home = x y_home = y width = w height = h SetCenter(x + w/2, y + h/2) EndFunction EndType Graphics 800 , 600, 0, 60, GRAPHICS_BACKBUFFER|GRAPHICS_ALPHABUFFER 'Graphics 800 , 600 SetColor 0 , 0 , 0 Cls Local picture:Timage = LoadImage("incbin::star.png" , -1) If picture = Null RuntimeError "Could not load Picture!" EndIf TStarfield.SetDimensions(0,0,800,600) TStarfield.SetAcceleration(1.01) TStarfield.SetFade(1.5) TStarfield.SetImage(picture) Local StarCount:Int = 1500 Repeat If StarCount > 0 TStarfield.EmitStars(1) Starcount :- 1 Endif SetColor 255 , 255 , 255 Cls TStarfield.UpdateAll() TStarfield.DrawAll() Flip Until AppTerminate() Or KeyDown(KEY_ESCAPE)
This ist the Image