OOP and Speed

BlitzMax Forums/BlitzMax Beginners Area/OOP and Speed

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If you have an instance of TPlayer you always need, then yes, you should have a straight reference to it, not only having it in the list.

As the player isn't just a regular object but a very specific and central one (as all the userinput normally applies to it), using a list only would be a very bad idea performance wise.

Using the list for operations is a good idea if you have for example several enemies (like in a space invader game as easy to understand example), so you can calculate the behavior of all enemies in the enemylist for one after another. As you need to do this for all enemies in the list, using the list is a good idea, as it does not have an "useless operation" overhead anymore. As well you can dynamically create new enemies without thinking about new variable names etc.