From 05092266037e7b89e3acb7886cb572d71351c376 Mon Sep 17 00:00:00 2001 From: Jeremiah Billmann Date: Fri, 26 Jul 2013 15:16:22 -0400 Subject: [PATCH] Progress: Documentation --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 91be508..21f4090 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ entities.forEach(function (entity) { ### Client +**1.** Initialize GarageServer.IO ```js -// Initialize GarageServer.IO GarageServerIO.initializeGarageServer('http://insertmygameurlhere.com', { onReady: function () { // Call your game loop @@ -62,8 +62,13 @@ GarageServerIO.initializeGarageServer('http://insertmygameurlhere.com', { // Extract world state sent from server } }; - -// Inside render loop, extract player and entity states +``` +**2.** Inside physics loop, capture and send input via GarageServer.IO +```js +GarageServerIO.addInput(myInput); +``` +**3.** Inside render loop, extract player and entity states +```js GarageServerIO.getStates(function (playerStates, entityStates) { playerStates.forEach(function (player) { ctxCanvas.fillRect(player.state.x, player.state.y, 5, 5); @@ -73,9 +78,6 @@ GarageServerIO.getStates(function (playerStates, entityStates) { ctxCanvas.fillRect(entity.state.x, entity.state.y, 5, 5); }); }); - -// Inside physics loop, capture and send input -GarageServerIO.addInput(myInput); ``` ## API