add basic updating to client on physics

This commit is contained in:
Asraelite 2016-03-21 23:45:27 +00:00
parent 95e0f6b710
commit 1027d980c1
15 changed files with 160 additions and 13 deletions

View file

@ -17,6 +17,26 @@ function Renderer() {
pallet.clear();
pallet.fill('#000');
this.renderGrid();
for (var id in game.world.bodies) {
var body = game.world.bodies[id];
pallet.rect('#338', body.x, body.y, 10, 10);
}
}
this.renderGrid = function() {
var ox = (game.world.playerShip.x || 0) % 50;
var oy = (game.world.playerShip.y || 0) % 50;
for (var x = -50 + ox; x < canvas.width + 50; x += 50) {
for (var y = -50 + oy; y < canvas.height + 50; y += 50) {
pallet.outline('#0a0a0a', x, y, 51, 51, 1);
}
}
}
pallet.fillScreen();