Greetings Puppies,
Hmmm, it doesn't seem to work.
Please see updated code below.
Any suggestions?
Peace,
Jes
Hmmm, it doesn't seem to work.
Please see updated code below.
Strict Graphics 800,600,0 Type ParentType Field id Field x#,y# Field xdir#, ydir# Field name$ Function Create:ParentType(newname$, i) Print "Arrived at Create" Local temp:ParentType = New ParentType temp.id = i temp.x = Rnd(800) temp.y = Rnd(600) temp.name$ = newname$ Local n n = Rand(2) If n=1 Then temp.xdir = 1 Else temp.xdir = -1 End If n = Rand(2) If n=1 Then temp.ydir = 1 Else temp.ydir = -1 End If Return temp End Function Method Move() x:+xdir y:+ydir If x<0 Or x>800 Then xdir:*-1 If y<0 Or y>600 Then ydir:*-1 End Method Method Show() SetAlpha(Float id/100) DrawText name, x, y End Method End Type Type YAxis Extends ParentType Function Create:YAxis(newname$,i) Local temp:YAxis temp = YAxis(Super.Create(newname$,i)) If temp = Null Then Print "Temp not created!!" DebugStop End If Return temp End Function Method Move() y:+ydir If y<0 Or y>600 Then ydir:*-1 End Method Method Show() SetAlpha(Float id/100) DrawText name, x, y End Method End Type Local parents:TList Local i parents = CreateList() Local myinstance:ParentType Local y_axis:YAxis For i = 1 To 100 myinstance:ParentType = ParentType.Create("X and Y : " + i, i) parents.addlast(myinstance) Next For i = 1 To 100 y_axis:YAxis = YAxis.create("Y Only : " + i,i) If y_axis = Null Then Print "Y Axis Not Created!!" DebugStop End If parents.addlast(y_axis) Next SetBlend(alphablend) While Not KeyDown(key_escape) Cls For myinstance = EachIn parents myinstance.move myinstance.show Next For y_axis = EachIn parents y_axis.move y_axis.show Next FlushMem ; Flip Wend End
Any suggestions?
Peace,
Jes