draw method in parent type

BlitzMax Forums/BlitzMax Programming/draw method in parent type

what youre looking for is

Type Tobj
Field x,y
Method draw()
    Plot(x,y)
EndMethod
EndType

Type Tship Extends Tobj
Field img:Timage=yourGlobalShipImage
Method draw()
    DrawImage(img,x,y)
EndMethod
EndType


Type Trock Extends Tobj
Field img:Timage=yourGlobalRockImage
Method draw()
    DrawImage(img,x,y)
EndMethod
EndType

Global myObjs:Tlist=New Tlist

While Not AppTerminate()
    For Local o:Tobj=EachIn myObjs
        o.draw()
    Next
Wend


--edit to add: you put your Tship and Trocks in the list and it will auto use the right draw() in case that wasnt obvious