Skip to content

Instantly share code, notes, and snippets.

@slashman
Last active August 29, 2015 14:05
Show Gist options
  • Save slashman/3c98a4c84510829efac3 to your computer and use it in GitHub Desktop.
Save slashman/3c98a4c84510829efac3 to your computer and use it in GitHub Desktop.
Ananias Player serialization
circular.registerClass('Player', Player, {
transients: {
gameController: true,
sprite: true
},
reviver: function(object, reviverData){
object.gameController = reviverData.gameController;
var gameController = object.gameController;
for (var i = 0; i < object.items.length; i++){
var item = object.items[i];
gameController.addItemToRoom(item);
gameController.addItemToInventory(item);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment