I thought before you could call a method you needed and instance of the type. I might be wrong but should your init_star be a function?
Also the instance name isn't needed within the method
This works but whether it's OOP I don't know...
Also the instance name isn't needed within the method
This works but whether it's OOP I don't know...
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 update_star() If speed = 1 y :+ 2 else y :+ 1 endif If y > Y_RES y = y - Y_RES End method Method draw_star() SetBlend(SOLIDBLEND) ; SetColor(255,255,255) If speed = 1 SetColor(255,255,255) Plot(x,y) Else Local star_bright = Rand(1,100) If star_bright < 11 SetColor(255,255,255) else SetColor(128,128,128) endif Plot(x,y) EndIf End method function init_star() Local loop : Int For loop = 1 To 75 Local Astar:star = New star ListAddLast star_list,astar 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 function End Type '---------------------------------------------------------- Graphics(X_RES,Y_RES,32,0) HideMouse() star.init_star() Repeat Cls For Local astar:star = EachIn star_list astar.update_star astar.draw_star Next flip Until KeyHit(KEY_ESCAPE)