Add basic planet collision

This commit is contained in:
asraelite 2018-03-03 14:02:20 +00:00
parent b02675f4fb
commit 09b3df649c
6 changed files with 42 additions and 11 deletions

View file

@ -3,8 +3,8 @@ import {images as assets} from '../assets.mjs';
import * as world from '../world/index.mjs';
export function render() {
world.ships.forEach(renderShip);
world.celestials.forEach(renderCelestial);
world.ships.forEach(renderShip);
}
function renderShip(ship) {
@ -24,5 +24,6 @@ const celestialImages = {
}
function renderCelestial(cel) {
context.drawImage(cel.image, cel.x, cel.y, cel.diameter, cel.diameter);
context.drawImage(cel.image, cel.x - cel.radius, cel.y - cel.radius,
cel.diameter, cel.diameter);
}