Game State / Screen Management
Posted
by
Ashylnn Mac
on Game Development
See other posts from Game Development
or by Ashylnn Mac
Published on 2011-06-29T03:56:36Z
Indexed on
2011/06/29
8:32 UTC
Read the original article
Hit count: 236
architecture
|actionscript-3
What's the best way to handle game states / screens? My problem is this:
PlayGameScreen adds a new InventoryGameScreen to the game during it's update. This immediately adds InventoryGameScreen to the array of GameScreens. That's throwing an exception when iterating over the array that the contents of the array have changed.
Should I have two more arrays, like screensToBeAdded and screensToBeRemoved and do all the processing for them at the end of the game loop after drawing all the other screens?
© Game Development or respective owner