I created a 'character' class and put a 'characterList' as a global variable under that class. I was thinking that I could use that list to keep in track about the characters and update them.
I also wrote a class function (not method) "updateAll" where I planned to go through the list of characters and call "character.update" for each of them. Now in the game I would call "TCharacter.updateAll" or something similar to update all characters.
I think this is bit messy way to do this, since now the character class also handles the list.
I thought to create characterHandler (static) class that would contain a list where characters would be put. This way in the game the TCharacter and TCharacterHandler classes would be separate, and I'd call "TCharacterHandler.update", which would loop through its own list and update all the characters.
I'm reading about design patterns and there's so much new stuff that I need a fresh brain (yours :)) here to help me out. How do you handle lists and do you have many classes?
Gimme a better solution, pretty please :)
EDIT: Looks like the handler class is something that I could use (good to have other people using this approach too)
I also wrote a class function (not method) "updateAll" where I planned to go through the list of characters and call "character.update" for each of them. Now in the game I would call "TCharacter.updateAll" or something similar to update all characters.
I think this is bit messy way to do this, since now the character class also handles the list.
I thought to create characterHandler (static) class that would contain a list where characters would be put. This way in the game the TCharacter and TCharacterHandler classes would be separate, and I'd call "TCharacterHandler.update", which would loop through its own list and update all the characters.
I'm reading about design patterns and there's so much new stuff that I need a fresh brain (yours :)) here to help me out. How do you handle lists and do you have many classes?
Gimme a better solution, pretty please :)
EDIT: Looks like the handler class is something that I could use (good to have other people using this approach too)