add ship rendering and damping

This commit is contained in:
Asraelite 2016-03-22 13:18:43 +00:00
parent 05ad81ed8d
commit 80bd84230d
22 changed files with 66 additions and 6 deletions

View file

@ -43,7 +43,11 @@ function Renderer() {
for (var id in game.world.bodies) {
var body = game.world.bodies[id];
pallet.rect('#338', body.x, body.y, 10, 10);
if (body.bodyType == 'ship') {
renderShip(pallet, body);
} else {
pallet.rect('#338', body.x, body.y, 10, 10);
}
}
context.restore();

View file

@ -1,3 +1,11 @@
function RenderShip(ship) {
function renderShip(pallet, ship) {
var img = game.assets.images.ships[ship.hull].hull;
var col = game.assets.images.ships[ship.hull].teamb;
var thr0 = game.assets.images.ships[ship.hull].thrust0;
var thr5 = game.assets.images.ships[ship.hull].thrust5;
var thr8 = game.assets.images.ships[ship.hull].thrust8;
//pallet.view(ship.x, ship.y, false, ship.r);
pallet.image(col, ship.x, ship.y, ship.r);
pallet.image(img, ship.x, ship.y, ship.r);
pallet.image(ship.move[0] ? thr8 : thr0, ship.x, ship.y, ship.r);
}