In my game there are players and an enemy. If the player shoots an enemy, that enemy dies. Easy. If I want to save that individual enemy's dead or alive state and load it, how would I go about doing that? For example:
In my XML level file, there are three different enemies, like so:
<entity x="400" y="400" type="enemy"/>
<entity x="600" y="200" type="enemy"/>
<entity x="700" y="900" type="enemy"/>
If the player shoots the enemy that originated at 400, 400, or any other coordinate and that enemy dies I want to save that to sharedPreferences either in an array of enemies or as a boolean, and when the game is loaded, I want the dead enemy to stay dead and not be loaded. I could easily make an enemy1, enemy2, enemy3... object and have individual booleans for them, but there has to be a way to save and load for multiple objects of the same entity, if that makes any sense. (The enemy at 400, 400 the enemy at 600, 200 etc...)
How would I go about doing this?
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads