Add particles

This commit is contained in:
asraelite 2018-03-04 01:21:34 +00:00
parent dda4a44386
commit 9435e887a4
11 changed files with 1684 additions and 4826 deletions

View file

@ -16,7 +16,7 @@ export function render() {
renderLayer(patterns.back, 0.3, 1);
renderLayer(patterns.middle, 0.5, 0.3);
renderLayer(patterns.front, 0.7, 0.3);
//renderLayer(patterns.front, 0.7, 0.3);
}
function renderLayer(pattern, speed = 1, scale = 1) {

View file

@ -3,11 +3,14 @@ import {images as assets} from '../assets.mjs';
import * as world from '../world/index.mjs';
export function render() {
world.particles.forEach(renderParticle);
world.celestials.forEach(renderCelestial);
world.ships.forEach(renderShip);
if (typeof window.q !== 'undefined') {
context.fillStyle = 'red';
}
}
function renderParticle(particle) {
context.fillStyle = particle.color;
context.fillRect(...particle.com, particle.size, particle.size);
}
function renderShip(ship) {