Clear land below tanks on placement
This commit is contained in:
1 parent
900a85630d
commit
cd084cc3e6
1 file changed
+6
-3
@@ -4,7 +4,7 @@ import {key} from './input.js';
|
|||||||
import {clamp, deg2rad, parable, randomInt, vec, wrap} from './math.js';
|
import {clamp, deg2rad, parable, randomInt, vec, wrap} from './math.js';
|
||||||
import {createSky} from './sky.js';
|
import {createSky} from './sky.js';
|
||||||
import {audio, createOsc, playTickSound} from './sound.js';
|
import {audio, createOsc, playTickSound} from './sound.js';
|
||||||
import {collapseTerrain, createTerrain, isTerrain, landHeight, closestLand} from './terrain.js';
|
import {collapseTerrain, createTerrain, isTerrain, landHeight, closestLand, clipTerrain} from './terrain.js';
|
||||||
import {WEAPON_TYPES, EXPLOSION_TYPES, DEATH_SPECS} from './weapons.js';
|
import {WEAPON_TYPES, EXPLOSION_TYPES, DEATH_SPECS} from './weapons.js';
|
||||||
import {sample} from './utils.js';
|
import {sample} from './utils.js';
|
||||||
import {AI_TYPES} from './ai.js';
|
import {AI_TYPES} from './ai.js';
|
||||||
@@ -37,10 +37,12 @@ for (let c of [sky, terrain, projectiles, foreground]) {
|
|||||||
let i=0;
|
let i=0;
|
||||||
for (let color of PLAYER_COLORS) {
|
for (let color of PLAYER_COLORS) {
|
||||||
const x = Math.round(50 + (W-100) / 5 * i);
|
const x = Math.round(50 + (W-100) / 5 * i);
|
||||||
|
const y = landHeight(terrain, x) + 1;
|
||||||
const a = x > W/2 ? 45 : 180-45;
|
const a = x > W/2 ? 45 : 180-45;
|
||||||
players.push({
|
players.push({
|
||||||
x, y: landHeight(terrain, x)+1, a,
|
x, y, a,
|
||||||
p: PLAYER_INITIAL_POWER, c: color,
|
c: color,
|
||||||
|
p: PLAYER_INITIAL_POWER,
|
||||||
weapons: [
|
weapons: [
|
||||||
{type: 'baby-missile', ammo:Infinity},
|
{type: 'baby-missile', ammo:Infinity},
|
||||||
{type: 'missile', ammo:5},
|
{type: 'missile', ammo:5},
|
||||||
@@ -54,6 +56,7 @@ for (let color of PLAYER_COLORS) {
|
|||||||
ai: i !== 0 ? 'moron' : undefined,
|
ai: i !== 0 ? 'moron' : undefined,
|
||||||
fallHeight: 0,
|
fallHeight: 0,
|
||||||
});
|
});
|
||||||
|
clipTerrain(terrain, (ctx) => drawRect(ctx, x-4, 0, 8, y, ctx.color));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user