Skip to content

Instantly share code, notes, and snippets.

@diiq
Created May 10, 2015 23:12
Show Gist options
  • Save diiq/28f5775118130b0d9c67 to your computer and use it in GitHub Desktop.
Save diiq/28f5775118130b0d9c67 to your computer and use it in GitHub Desktop.
var save_squares = {};
var dingsave = function (actor) {
// A checkpoint; saves your game and goes 'ding'
if (actor.type === "player") {
grid.tiles[actor.x][actor.y].hash = "_";
if (!save_squares["" + actor.x + actor.y]){
save_squares["" + actor.x + actor.y] =
{color:actor.color, tilemap:brief_tilemap(grid.tilemap)};
}
transitions.push(function(){
if (callbacks.ding)
callbacks.ding(count);
count = 0;
grid.tiles[actor.x][actor.y].hash = "_";
actor.color = save_squares["" + actor.x + actor.y].color;
grid.tilemap = unbrief_tilemap(save_squares["" + actor.x + actor.y].tilemap);
actor.save(grid);
});
}
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment