Skip to content

Instantly share code, notes, and snippets.

@limptwiglet
Created May 24, 2012 13:19
Show Gist options
  • Save limptwiglet/2781503 to your computer and use it in GitHub Desktop.
Save limptwiglet/2781503 to your computer and use it in GitHub Desktop.
var players = {
324234: {
x: 100,
y: 100
}
};
socket.on('message', function (data) {
if (data.type === 'move') {
var player = players[socket.id];
if (player) {
player.x = data.x;
player.y = data.y;
}
}
});
setInterval(function () {
// Here you can loop over your player objects
}, 1000 / 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment