have a look at this please. Although it does what i want it to as in it draws a set number of squares and circles to the screen from a list of instances of a class/type im sure ive not got it quite right. help?
Global width:Int = 640 Global height:Int = 480 Graphics width,height Global cx,cy,csize:Int Global shapecount:Int = 0 Global Spritelist:TList = New TList AutoMidHandle(enable) HideMouse Type sprite Field shape Field cx Field cy Field csize Field red,green,blue Method draw(shape,cx,cy,csize,red,green,blue) SetColor red,green,blue If shape = 1 DrawOval(cx,cy,csize,csize) EndIf If shape = 2 DrawRect(cx,cy,csize,csize) EndIf EndMethod Function Create:sprite(shape,cx,cy,csize,red,green,blue) Local s:sprite = New sprite s.shape = Rand(1,2) s.cx = Rand(-100,640) s.cy = Rand(-100,480) s.csize = Rand(10,100) s.red = Rand(10,255) s.green = Rand(10,255) s.blue = Rand(10,255) Return s EndFunction EndType While Not KeyDown(KEY_ESCAPE) If shapecount < 1000 Spritelist.addlast(sprite.Create(shape,cx,cy,csize,red,green,blue)) shapecount = shapecount +1 EndIf Local s:sprite For s=EachIn Spritelist s.draw(s.shape,s.cx,s.cy,s.csize,s.red,s.green,s.blue) Next Flip Cls Wend End