3 ms·
With the benefit of hindsight, is the implementation you used actually better than using globals?
by travbrack 7y ago
With the benefit of hindsight, is the implementation you used actually better than using globals?
- diegomacario 7y agoI would say that it is. I think that the idea of having each state be its own class is very natural, and that it helps organize the code very effectively. My failure was in how I made those classes share many components that they shouldn't be sharing, thinking that this would make things more efficient without any proof to support that. So even though my code uses global variables implicitly, I still think the pattern I used for game state management makes it more organized than an implementation where everything is global. I hope this answer your question :-)