nscoding a ccsprite - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: nscoding a ccsprite (/thread-9000.html)
nscoding a ccsprite - shadowgate15 - May 25, 2011 08:39 PM
i have been trying to encode my player class which is a subclass of ccsprite. However it doesn't load properly. the debugger says it exists but not on the screen and my movement doesn't work.
Here is my encoding and decoding code for the player class.
RE: nscoding a ccsprite - Skorche - May 26, 2011 08:57 AM
For that to work, your entire Cocos2D scene would have to be serialized. Pretty certain that Cocos2D doesn't support that, and probably never will.
RE: nscoding a ccsprite - shadowgate15 - May 26, 2011 11:17 AM
so then how would i do any sort of save game using cocos2d. because even if i pull the nscoding out and just set those variables in the scene the player still doesn't appaer. the code for that part initalizes the ccsprite then sets its position and inventory.
RE: nscoding a ccsprite - Skorche - May 26, 2011 01:36 PM
You don't need serialization to implement save games. You just need to store the things that are important and use that to make a new scene.
Depending on your needs, your save data could be as simple as the player's location, the number of enemies, and the enemy locations. You don't need to do a full serialization to save and load that.