Type foo global list:tlist = createlist() ' ... other stuff Function draw_all() for local f:foo = eachin list f.draw() next EndFunction method new() list.addlast( self ) endmethod EndType ' .... game init local bar:foo = new foo ' automatically added to the list ' ... Inside main loop foo.draw_all() ' This will draw all foo's in the list
No need to call foo.init() or something, the list is created when the application/game starts.
I usually have one function for drawing stuff and another for updating logic. Always separate drawing and logic.
Everything written from memory while it's way past bedtime and I'm having a cold. So this might contains buggs and typos.
See the tutorials by Wave for some excellent stuff.