Add collectable items

This commit is contained in:
asraelite 2018-03-05 23:53:32 +00:00
parent 826986cdbf
commit 69fee5e73d
10 changed files with 131 additions and 52 deletions

View file

@ -7,6 +7,7 @@ export function render() {
world.particles.forEach(renderParticle);
world.celestials.forEach(renderCelestial);
world.ships.forEach(renderShip);
world.entities.forEach(renderEntity);
}
function renderParticle(particle) {
@ -14,6 +15,14 @@ function renderParticle(particle) {
context.fillRect(...particle.com, particle.size, particle.size);
}
function renderEntity(entity) {
context.save();
context.translate(...entity.com);
context.rotate(entity.r);
context.drawImage(entity.image, -0.5, -0.5, 1, 1);
context.restore();
}
function renderShip(ship) {
context.save();
context.translate(...ship.com);