Ok I am trying to wrap my head around objects...
I have a base type that can display an object and handle input. When it is created, it goes into a master list for display items.
Now I extend that type do make the varrious display objects do different functions. One type of display object displays a player, another shows stats, etc. All of the functionality is handled here as to what happens when the player interacts with the object.
When I create I assume that I call the extended type to create both.
Now when I loop through the master display list, do I get the extended type as well as the base display type? Or do I need to have some kind of index to tie them together?
Example:
Now when I loop through my display list do I do my eachin on playerselection objects, or displayobjects? If I do the loop on displayobjects (since that is what is added to the list) do I get the associated playerselection object as well?
I love this object stuff, but this is my first go with it. Neat and really functional!
I have a base type that can display an object and handle input. When it is created, it goes into a master list for display items.
Now I extend that type do make the varrious display objects do different functions. One type of display object displays a player, another shows stats, etc. All of the functionality is handled here as to what happens when the player interacts with the object.
When I create I assume that I call the extended type to create both.
Now when I loop through the master display list, do I get the extended type as well as the base display type? Or do I need to have some kind of index to tie them together?
Example:
type displayitem method showitem() stuff... end method method new() displist.addlast self end method end type type playerselection extends basetype method handleinput() stuff end method method create() return new playerselection end method end type local p:playerselection local a for a = 1 to 1000 p:playerselection = p.create() next
Now when I loop through my display list do I do my eachin on playerselection objects, or displayobjects? If I do the loop on displayobjects (since that is what is added to the list) do I get the associated playerselection object as well?
I love this object stuff, but this is my first go with it. Neat and really functional!