Add collectable items
This commit is contained in:
parent
826986cdbf
commit
69fee5e73d
10 changed files with 131 additions and 52 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue