Could somebody please finish off this bit of code for me? I'm trying to do things properly now - ie in OOP, and I'm not quite sure how to proceed.
It's just a parallex star field with stars of 2 speeds and the background stars vary in brightness.
Many thanks, Steve
It's just a parallex star field with stars of 2 speeds and the background stars vary in brightness.
Many thanks, Steve
Rem Scrolling Starfield End Rem Framework BRL.Basic Import BRL.glmax2d Import BRL.pngloader Strict '---------------------------------------------------------- ' global variables Const X_RES = 800, Y_RES = 600 : Int Global star_list:Tlist = CreateList() '---------------------------------------------------------- ' define types Type star Field x : Int Field y : Int Field speed : Int Method init_star() Local loop : Int For loop = 1 To 75 Astar:star = New star ListAddLast star_list, star Astar.speed = 1 If loop <= 50 Astar.speed = 0 Astar.x = Rand(10,X_RES-10) ; Astar.y = Rand(10,Y_RES-10) next End method Method update_star() If Astar.speed = 1 Astar.y :+ 2 else Astar.y :+ 1 endif If Astar.y > Y_RES Astar.y = Astar.y - Y_RES End method Method draw_star() SetBlend(SOLIDBLEND) ; SetColor(255,255,255) For Astar:star = EachIn star_list If Astar.speed = 1 SetColor(255,255,255) Plot(Astar.x,Astar.y) Else Local star_bright = Rand(1,100) If star_bright < 11 SetColor(255,255,255) else SetColor(128,128,128) endif Plot(Astar.x,Astar.y) EndIf next End method End Type '---------------------------------------------------------- Graphics(X_RES,Y_RES,32,0) HideMouse() Repeat Cls Until KeyHit(KEY_ESCAPE)