add basic updating to client on physics
This commit is contained in:
parent
95e0f6b710
commit
1027d980c1
15 changed files with 160 additions and 13 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue