diff --git a/main.js b/main.js index 5889ce0..32f7962 100644 --- a/main.js +++ b/main.js @@ -173,10 +173,7 @@ function update() { } else if (state === 'land-collapse') { - const target = explosion ||projectile; - if (target) { - collapseTerrain(terrain, target.x, 100); // FIXME: Hardcoded radius - } + collapseTerrain(terrain); state = 'land-players'; } diff --git a/terrain.js b/terrain.js index b0c10f6..4f1b144 100644 --- a/terrain.js +++ b/terrain.js @@ -50,15 +50,13 @@ const TERRAIN_TYPES = { } cacheImageData(ctx); - collapseTerrain(ctx, width/2, width/2); + collapseTerrain(ctx); } }; -export function collapseTerrain(ctx, ox, r) { - const {height} = ctx.canvas; - const width = r * 2 + 10; - const left = ox-r-5; - const imageData = ctx.getImageData(left, 0, width, height); +export function collapseTerrain(ctx, ) { + const {width, height} = ctx.canvas; + const imageData = ctx.getImageData(0, 0, width, height); for (let x=0; x 0) land++; } - ctx.clearRect(left+x, 0, 1, height); - drawRect(ctx, left+x, height-land, 1, land, ctx.color); + ctx.clearRect(0+x, 0, 1, height); + drawRect(ctx, 0+x, height-land, 1, land, ctx.color); } cacheImageData(ctx);