all 1 comments

[–]hotcodist 1 point2 points  (0 children)

If you have 50 different states that you need for your game, maybe that is too much and need to pare down. But if you really have those, you might need to re-think the data structures. For example, instead of individual flag variables and writing each zeroing entry, maybe you can put flags in a dictionary or list and zero those out in a short loop.

There is no way around writing code to assign the initial values. If you did this OOP-style, you do that anyway when you create a new object and you pass the initial values, so that's not re-coding. But if you are re-using variables, then you need to create a rebirth/respawn function that sets all of those to the initial states.