How does one keep track of many tasks on the screen, such as the enemies, the players, the background, ect. ? Is it proper to use threads, or is there some other way of keeping track of all of this? Thanks! ^_^
How does one keep track of many tasks on the screen, such as the enemies, the players, the background, ect. ? Is it proper to use threads, or is there some other way of keeping track of all of this? Thanks! ^_^
There are many ways of doing this. My preference is Enemy, Item, Effect, Player, (etc...) classes for your game objects. Most likely these have common aspects, like positions and stuff so you may want to inherit from some general Object class. Then store the objects in lists which you traverse and update in every game loop. I wouldn't recommend the use of threads unless you really need it.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.