Type Alien Global List:TList = CreateList() Field _Link:TLink Function Create() Local A:Alien A = New Alien A._Link = List.AddLast(A) End Function Function UpdateAll() Local A:Alien For A = EachIn List A.Update() Next End Function Method Update() End Method Method Free() _Link.Remove() _Link = Null End Method End Type
Just Alien.Create() to create an alien, call Alien.UpdateAll() in your main loop, and that will call the Update() function for each alien, inside which you can access the fields of the type. And when the alien is destroyed just call Free() or Self.Free() in its update function, or with the pointer to it if freeing it from somewhere else.