basic Tlist stuff
BlitzMax Forums/BlitzMax Beginners Area/basic Tlist stuff
| ||
Lets say i have a tilebased game. Lets say i want to have objects stored in a Tlist instead of have them in a 2-dimensional array. Lets say the player approaches the object to interact in some way. How do i select that object from a Tlist without going through the whole list, searching for coordinates or similar ? |
| ||
You can't You better do a 2D array of a tile type to which you add a TList which holds all dynamic objects on this field. This way you can go straight to the dynamic objects on a specific field. The only other possibility would be to use TMap and use "X Y" as Key as well as the object for the value. But then you can only have 1 object per coordinate. |
| ||
Look into using an array of types. You might also want to search for hashmaps and Tmaps as others have suggested these in the past. |