This commit is contained in:
Jeremiah Billmann
2013-07-14 14:58:40 -04:00
parent 9d364265e9
commit 47d0ec5e7d
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -37,6 +37,11 @@ Game.prototype.update = function () {
entities.forEach(function (entity) {
var newState = gamePhysics.getNewEntityState(entity.state, self.physicsDelta);
self.server.updateEntityState(entity.id, newState);
if (newState.x < 0 || newState.y < 0 || newState.x > self.worldState.width || newState.y > self.worldState.height) {
self.server.removeEntity(entity.id);
}
else {
self.server.updateEntityState(entity.id, newState);
}
});
};
+1 -1
View File
@@ -25,7 +25,7 @@
if (garageServer) {
var newId = guid();
garageServer.addEntity(newId);
garageServer.updateEntityState(newId, { x: state.x, y: state.y, direction: state.direction } );
garageServer.updateEntityState(newId, { x: state.x + 5, y: state.y + 5, direction: state.direction } );
}
}
}