reduce update packet size by ~70%
This commit is contained in:
parent
1af386d9f5
commit
0906441246
20 changed files with 219 additions and 143 deletions
|
@ -31,8 +31,7 @@ class Renderer {
|
|||
if (state == 'connecting' || state == 'disconnected') {
|
||||
pallet.clear();
|
||||
pallet.fill('#111');
|
||||
var str = state == 'connecting' ? 'Connecting' : 'Shit\'s ' +
|
||||
'diconnected, yo!';
|
||||
var str = state == 'connecting' ? 'Connecting' : 'Disconnected';
|
||||
pallet.text(str, canvas.width / 2, canvas.height / 2, '#fff',
|
||||
'FreePixel', 16, 'center', 'middle');
|
||||
return;
|
||||
|
|
|
@ -16,9 +16,9 @@ Renderer.prototype.renderShip = (pallet, ship) => {
|
|||
pallet.view(x + vx, y + vy, false, pos.r);
|
||||
|
||||
let ts = ship.size / 2;
|
||||
for (let i = 0; i < ship.mounts.length; i++) {
|
||||
if (ship.turrets[i]) {
|
||||
pallet.image(turr, ship.mounts[i][0] - ts, ship.mounts[i][1] - ts, 0);
|
||||
for (let i = 0; i < ship.fixtures.length; i++) {
|
||||
if (ship.fixtures[i]) {
|
||||
pallet.image(turr, ship.fixtures[i][0] - ts, ship.fixtures[i][1] - ts, 0);
|
||||
}
|
||||
}
|
||||
pallet.image(ship.team == 'a' ? teama : teamb, 0, 0, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue