Global sprites only or is there another way?
Posted: Sat Apr 19, 2008 1:53 pm
I want to load some sprites, but I have four sections of the app that I am making, and these sprites are dedicated to each section - the sprites don't over lap sections.
That's all fine, but I have before the main game loop four data loading procedures, one for each section, and then it goes into Section1() which then holds a game loop until a selection is made to send it into Section2, Section3 or Section4 loop.
The thing is that currently I have to hold all the sprites as globals so they can be loaded in one procedure upfront and then actually used in other procedure, and now I'm getting a lot of them.
Coming from the school of thought that globals are a Bad Thing(tm) is there a better way of partitioning the variables for cases such as this, or is this the beauty of procedural programming that keeps things fast?
That's all fine, but I have before the main game loop four data loading procedures, one for each section, and then it goes into Section1() which then holds a game loop until a selection is made to send it into Section2, Section3 or Section4 loop.
The thing is that currently I have to hold all the sprites as globals so they can be loaded in one procedure upfront and then actually used in other procedure, and now I'm getting a lot of them.
Coming from the school of thought that globals are a Bad Thing(tm) is there a better way of partitioning the variables for cases such as this, or is this the beauty of procedural programming that keeps things fast?