Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Is there a way to save the player's position to a variable? Then load it? So then, I could simply save and load where the player is standing for a simple save game. Thanks! |
||||
|
well... when you save you want to grab the position of the player with javascript interface... var player=ccbGetSceneNodeFromName("Camera1"); var curPos=ccbGetSceneNodeProperty(player,"Position"); and set your saved variable... ccbSetCopperCubeVariable("savePosition",curPos); then use the save variable action... ---> variables and text ---> load or save variable... select 'save variable' then type 'savePosition' into the box... and then… when you want to load the position… have something trigger this... ---> variables and text ---> load or save variable... select 'load variable' then type 'savePosition' into the box.. then get and set your player position to the saved position with javascript interface… var player=ccbGetSceneNodeFromName("Camera1"); var savePosition =ccbGetCopperCubeVariable("savePosition"); ccbSetSceneNodeProperty(player,"Position", savePosition); and voila! p.s. this seems to work on PC but not MAC. I think this could be a bug on Mac. |
||||
|
Ha! This worked perfectly! Thanks so much! (This totally should be added into the documentation :D ) |
|