made graphics more cartoony
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 486 B |
BIN
public/img/favicon_large.png
Normal file
After Width: | Height: | Size: 649 B |
BIN
public/img/main.png
Normal file
After Width: | Height: | Size: 678 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 422 B |
BIN
public/img/ships/01/hull_old.png
Normal file
After Width: | Height: | Size: 355 B |
|
@ -15,9 +15,14 @@ Renderer.prototype.renderAsteroid = (pallet, body) => {
|
|||
context.lineTo(points[i][0], points[i][1]);
|
||||
}
|
||||
context.closePath();
|
||||
context.strokeStyle = '#fff';
|
||||
context.clip();
|
||||
context.fillStyle = body.debug ? `rgb(${body.debug}, 9, 9)` : '#090909';
|
||||
context.fill();
|
||||
context.lineWidth = 7;
|
||||
context.strokeStyle = '#000';
|
||||
context.stroke();
|
||||
context.lineWidth = 3;
|
||||
context.strokeStyle = '#fff';
|
||||
context.stroke();
|
||||
|
||||
pallet.restore();
|
||||
|
|
|
@ -39,7 +39,7 @@ class Renderer {
|
|||
}
|
||||
|
||||
pallet.clear();
|
||||
pallet.fill('#000');
|
||||
pallet.fill('#020202');
|
||||
|
||||
context.save();
|
||||
|
||||
|
@ -49,16 +49,20 @@ class Renderer {
|
|||
// Grid
|
||||
var gridx = cx % 50;
|
||||
var gridy = cy % 50;
|
||||
pallet.opacity(0.05);
|
||||
for (var x = gridx - cw / 2 - 50; x < cw + 50; x += 50) {
|
||||
for (var y = gridy - ch / 2 - 50; y < ch + 50; y += 50) {
|
||||
var wx = (-cx + x) / SCALE;
|
||||
var wy = (-cy + y) / SCALE;
|
||||
var b = game.world.bounds;
|
||||
if (wx > b.right || wx < b.left || wy > b.bottom || wy < b.top)
|
||||
pallet.outline('#141424', x, y, 51, 51, 1);
|
||||
else pallet.outline('#0a0a0a', x, y, 51, 51, 1);
|
||||
if (wx > b.right || wx < b.left || wy > b.bottom || wy < b.top) {
|
||||
pallet.opacity(0.2);
|
||||
pallet.outline('#8af', x, y, 51, 51, 1);
|
||||
pallet.opacity(0.05);
|
||||
} else pallet.outline('#fff', x, y, 51, 51, 1);
|
||||
}
|
||||
}
|
||||
pallet.opacity(1);
|
||||
|
||||
for (var id in game.world.bodies) {
|
||||
var body = game.world.bodies[id];
|
||||
|
|
|
@ -60,7 +60,8 @@ class Physics {
|
|||
}
|
||||
|
||||
removeBody(body) {
|
||||
this.toRemove.push(body.b2body);
|
||||
if (body)
|
||||
this.toRemove.push(body.b2body);
|
||||
}
|
||||
|
||||
step() {
|
||||
|
@ -81,6 +82,7 @@ class Physics {
|
|||
body.b2body.SetLinearVelocity(new b2Vec2(body.xvel, body.yvel));
|
||||
body.b2body.SetAngularVelocity(body.rvel);
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.toRemove.length; i++) {
|
||||
this.world.DestroyBody(this.toRemove[i]);
|
||||
}
|
||||
|
|
|
@ -38,15 +38,11 @@ class World {
|
|||
if (data.type == 'structure') body = new Structure(data);
|
||||
if (data.type == 'missile') body = new Missile(data);
|
||||
|
||||
//if(data.type == 'ship') console.log(body);
|
||||
|
||||
this.bodies[body.id] = body;
|
||||
//if(data.type == 'ship') console.log(this.bodies);
|
||||
this.physics.createBody(body);
|
||||
};
|
||||
|
||||
remove(id) {
|
||||
//console.log(id);
|
||||
this.physics.removeBody(this.bodies[id]);
|
||||
delete this.bodies[id];
|
||||
};
|
||||
|
|