Add basic planet collision
This commit is contained in:
parent
b02675f4fb
commit
09b3df649c
6 changed files with 42 additions and 11 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue