Skip to content

Instantly share code, notes, and snippets.

@jamesflorentino
Created March 7, 2013 11:59
Show Gist options
  • Save jamesflorentino/5107560 to your computer and use it in GitHub Desktop.
Save jamesflorentino/5107560 to your computer and use it in GitHub Desktop.
ready(function(err, socket) {
createGameModel(function(err, game) {
createStage(function(err, stage) {
socket.on('entity.create', function(data) {
game.createEntity(data, function(entity) {
entity.say('hi!');
stage.createSpriteFromEntity(entity, function(sprite) {
sprite.animate('spawn');
});
});
});
socket.on('entity.remove', function(entityID) {
game.removeEntity(entityID, function(entity) {
entity.say('goodbye');
stage.getSpriteByID(entityID, function(sprite) {
sprite.animate('die');
});
});
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment