This commit is contained in:
Jeremiah Billmann
2013-07-14 15:13:59 -04:00
parent 47d0ec5e7d
commit 91da305524
3 changed files with 12 additions and 9 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ function Game (sockets) {
this.physicsInterval = 15;
this.physicsDelta = this.physicsInterval / 1000;
this.physicsIntervalId = 0;
this.worldState = { height: 400, width: 800 };
this.worldState = { height: 400, width: 800, playerSize: 15, entitySize: 5 };
this.server = garageServer.createGarageServer(sockets,
{
@@ -37,7 +37,7 @@ Game.prototype.update = function () {
entities.forEach(function (entity) {
var newState = gamePhysics.getNewEntityState(entity.state, self.physicsDelta);
if (newState.x < 0 || newState.y < 0 || newState.x > self.worldState.width || newState.y > self.worldState.height) {
if (newState.x < 0 - self.worldState.playerSize || newState.y < 0 - self.worldState.playerSize || newState.x > self.worldState.width || newState.y > self.worldState.height) {
self.server.removeEntity(entity.id);
}
else {