update to mod: anthropic principle - only works once per level
  but gives 6 seconds of damage immunity and 2 extra heal power ups

most energy regeneration effects now overfill energy above the max by default
piezo electricity over fills energy by 300% (was 100%)
This commit is contained in:
landgreen
2020-11-04 05:36:50 -08:00
parent d7ab196dc3
commit a57ff0c4c1
10 changed files with 1845 additions and 1865 deletions

View File

@@ -3223,6 +3223,7 @@ const b = {
ctx.stroke(); ctx.stroke();
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
} else if (mod.beamSplitter) { } else if (mod.beamSplitter) {
const divergence = mech.crouch ? 0.15 : 0.2
let dmg = mod.laserDamage * 0.9 let dmg = mod.laserDamage * 0.9
const where = { const where = {
x: mech.pos.x + 20 * Math.cos(mech.angle), x: mech.pos.x + 20 * Math.cos(mech.angle),
@@ -3234,12 +3235,12 @@ const b = {
}, dmg) }, dmg)
for (let i = 1; i < 1 + mod.beamSplitter; i++) { for (let i = 1; i < 1 + mod.beamSplitter; i++) {
b.laser(where, { b.laser(where, {
x: where.x + 3000 * Math.cos(mech.angle + i * 0.2), x: where.x + 3000 * Math.cos(mech.angle + i * divergence),
y: where.y + 3000 * Math.sin(mech.angle + i * 0.2) y: where.y + 3000 * Math.sin(mech.angle + i * divergence)
}, dmg) }, dmg)
b.laser(where, { b.laser(where, {
x: where.x + 3000 * Math.cos(mech.angle - i * 0.2), x: where.x + 3000 * Math.cos(mech.angle - i * divergence),
y: where.y + 3000 * Math.sin(mech.angle - i * 0.2) y: where.y + 3000 * Math.sin(mech.angle - i * divergence)
}, dmg) }, dmg)
dmg *= 0.9 dmg *= 0.9
} }

View File

@@ -133,7 +133,7 @@ function collisionChecks(event) {
mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
mob[k].foundPlayer(); mob[k].foundPlayer();
let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * game.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0 let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * game.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0
if (mod.isPiezo) mech.energy = mech.maxEnergy; if (mod.isPiezo && mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3
mech.damage(dmg); mech.damage(dmg);
if (mod.isBayesian) powerUps.ejectMod() if (mod.isBayesian) powerUps.ejectMod()
if (mob[k].onHit) mob[k].onHit(k); if (mob[k].onHit) mob[k].onHit(k);
@@ -214,15 +214,15 @@ function collisionChecks(event) {
} }
//determine if player is on the ground //determine if player is on the ground
Events.on(engine, "collisionStart", function (event) { Events.on(engine, "collisionStart", function(event) {
playerOnGroundCheck(event); playerOnGroundCheck(event);
// playerHeadCheck(event); // playerHeadCheck(event);
collisionChecks(event); collisionChecks(event);
}); });
Events.on(engine, "collisionActive", function (event) { Events.on(engine, "collisionActive", function(event) {
playerOnGroundCheck(event); playerOnGroundCheck(event);
// playerHeadCheck(event); // playerHeadCheck(event);
}); });
Events.on(engine, "collisionEnd", function (event) { Events.on(engine, "collisionEnd", function(event) {
playerOffGroundCheck(event); playerOffGroundCheck(event);
}); });

View File

@@ -499,6 +499,7 @@ const game = {
mech.spawn(); //spawns the player mech.spawn(); //spawns the player
level.levels = level.playableLevels.slice(0) //copy array, not by just by assignment
if (game.isCommunityMaps) { if (game.isCommunityMaps) {
level.levels.push("stronghold"); level.levels.push("stronghold");
level.levels.push("basement"); level.levels.push("basement");
@@ -681,26 +682,10 @@ const game = {
checks() { checks() {
if (!(mech.cycle % 60)) { //once a second if (!(mech.cycle % 60)) { //once a second
//every second energy above max energy loses 25% //energy overfill
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy + (mech.energy - mech.maxEnergy) * 0.75 if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy + (mech.energy - mech.maxEnergy) * 0.8 //every second energy above max energy loses 25%
if (mech.pos.y > game.fallHeight) { // if 4000px deep if (mech.pos.y > game.fallHeight) { // if 4000px deep
// Matter.Body.setPosition(player, {
// x: player.position.x,
// y: level.enter.y - 5000
// });
// mech.pos.x = player.position.x;
// mech.pos.y = playerBody.position.y - mech.yOff;
// const scale = 0.8;
// const velocityScale = 12
// mech.transSmoothX = canvas.width2 - mech.pos.x - (game.mouse.x - canvas.width2) * scale + player.velocity.x * velocityScale;
// mech.transSmoothY = canvas.height2 - mech.pos.y - (game.mouse.y - canvas.height2) * scale + player.velocity.y * velocityScale;
// mech.transX += (mech.transSmoothX - mech.transX) * 1;
// mech.transY += (mech.transSmoothY - mech.transY) * 1;
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: 0, x: 0,
y: 0 y: 0
@@ -738,7 +723,7 @@ const game = {
// } // }
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
if (mod.isEnergyRecovery && mech.energy < mech.maxEnergy) mech.energy += mech.maxEnergy * 0.06 if (mod.isEnergyRecovery) mech.energy += mech.maxEnergy * 0.05
if (mod.isHealthRecovery) mech.addHealth(0.01) if (mod.isHealthRecovery) mech.addHealth(0.01)
} }

View File

@@ -8,7 +8,8 @@ const level = {
onLevel: -1, onLevel: -1,
levelsCleared: 0, levelsCleared: 0,
bossKilled: false, bossKilled: false,
levels: ["skyscrapers", "rooftops", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber"], playableLevels: ["skyscrapers", "rooftops", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber"],
levels: [],
start() { start() {
if (level.levelsCleared === 0) { //this code only runs on the first level if (level.levelsCleared === 0) { //this code only runs on the first level
// level.difficultyIncrease(8) // level.difficultyIncrease(8)
@@ -17,7 +18,7 @@ const level = {
// game.setZoom(); // game.setZoom();
// mech.isCloak = true; // mech.isCloak = true;
// mech.setField("wormhole") // mech.setField("wormhole")
// b.giveGuns("grenades") // b.giveGuns("laser")
// for (let i = 0; i < 10; i++) { // for (let i = 0; i < 10; i++) {
// mod.giveMod("laser-bot"); // mod.giveMod("laser-bot");
// } // }
@@ -3796,26 +3797,19 @@ const level = {
} }
}, },
nextLevel() { nextLevel() {
if (level.bossKilled) { if (level.bossKilled) level.levelsCleared++;
level.levelsCleared++;
// level.levels.unshift("gauntlet"); //add bosses level to the end of the randomized levels list
// level.levels.unshift("finalBoss"); //add bosses level to the end of the randomized levels list
}
level.difficultyIncrease(game.difficultyMode) //increase difficulty based on modes level.difficultyIncrease(game.difficultyMode) //increase difficulty based on modes
if (level.levelsCleared > level.levels.length) level.difficultyIncrease(game.difficultyMode) if (level.levelsCleared > level.levels.length) level.difficultyIncrease(game.difficultyMode)
if (level.levelsCleared > level.levels.length * 1.25) level.difficultyIncrease(game.difficultyMode) if (level.levelsCleared > level.levels.length * 1.25) level.difficultyIncrease(game.difficultyMode)
if (level.levelsCleared > level.levels.length * 1.5) level.difficultyIncrease(game.difficultyMode) if (level.levelsCleared > level.levels.length * 1.5) level.difficultyIncrease(game.difficultyMode)
if (level.levelsCleared > level.levels.length * 2) level.difficultyIncrease(game.difficultyMode) if (level.levelsCleared > level.levels.length * 2) level.difficultyIncrease(game.difficultyMode)
level.onLevel++; //cycles map to next level level.onLevel++; //cycles map to next level
if (level.onLevel > level.levels.length - 1) level.onLevel = 0; if (level.onLevel > level.levels.length - 1) level.onLevel = 0;
//reset lost mod display //reset lost mod display
for (let i = 0; i < mod.mods.length; i++) { for (let i = 0; i < mod.mods.length; i++) {
if (mod.mods[i].isLost) mod.mods[i].isLost = false; if (mod.mods[i].isLost) mod.mods[i].isLost = false;
} }
mod.isDeathAvoidedThisLevel = false;
game.updateModHUD(); game.updateModHUD();
game.clearNow = true; //triggers in game.clearMap to remove all physics bodies and setup for new map game.clearNow = true; //triggers in game.clearMap to remove all physics bodies and setup for new map
}, },

View File

@@ -442,7 +442,7 @@ const mobs = {
} }
}, },
laser() { laser() {
const vertexCollision = function (v1, v1End, domain) { const vertexCollision = function(v1, v1End, domain) {
for (let i = 0; i < domain.length; ++i) { for (let i = 0; i < domain.length; ++i) {
let vertices = domain[i].vertices; let vertices = domain[i].vertices;
const len = vertices.length - 1; const len = vertices.length - 1;
@@ -582,7 +582,7 @@ const mobs = {
ctx.fillStyle = "rgba(0,0,0,0.07)"; ctx.fillStyle = "rgba(0,0,0,0.07)";
ctx.fill(); ctx.fill();
//spring to random place on map //spring to random place on map
const vertexCollision = function (v1, v1End, domain) { const vertexCollision = function(v1, v1End, domain) {
for (let i = 0; i < domain.length; ++i) { for (let i = 0; i < domain.length; ++i) {
let vertices = domain[i].vertices; let vertices = domain[i].vertices;
const len = vertices.length - 1; const len = vertices.length - 1;
@@ -649,7 +649,7 @@ const mobs = {
}, },
curl(range = 1000, mag = -10) { curl(range = 1000, mag = -10) {
//cause all mobs, and bodies to rotate in a circle //cause all mobs, and bodies to rotate in a circle
applyCurl = function (center, array, isAntiGravity = true) { applyCurl = function(center, array, isAntiGravity = true) {
for (let i = 0; i < array.length; ++i) { for (let i = 0; i < array.length; ++i) {
const sub = Vector.sub(center, array[i].position) const sub = Vector.sub(center, array[i].position)
const radius2 = Vector.magnitudeSquared(sub); const radius2 = Vector.magnitudeSquared(sub);
@@ -793,7 +793,7 @@ const mobs = {
//be sure to declare searchTarget in mob spawn //be sure to declare searchTarget in mob spawn
//accelerate towards the searchTarget //accelerate towards the searchTarget
if (!this.seePlayer.recall) { if (!this.seePlayer.recall) {
const newTarget = function (that) { const newTarget = function(that) {
if (Math.random() < 0.0005) { if (Math.random() < 0.0005) {
that.searchTarget = player.position; //chance to target player that.searchTarget = player.position; //chance to target player
} else { } else {
@@ -1006,7 +1006,7 @@ const mobs = {
//energy and heal drain should be calculated after damage boosts //energy and heal drain should be calculated after damage boosts
if (mod.energySiphon && dmg !== Infinity && this.dropPowerUp) { if (mod.energySiphon && dmg !== Infinity && this.dropPowerUp) {
mech.energy += Math.min(this.health, dmg) * mod.energySiphon mech.energy += Math.min(this.health, dmg) * mod.energySiphon
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy // if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy
} }
if (mod.healthDrain && dmg !== Infinity && this.dropPowerUp) { if (mod.healthDrain && dmg !== Infinity && this.dropPowerUp) {
mech.addHealth(Math.min(this.health, dmg) * mod.healthDrain) mech.addHealth(Math.min(this.health, dmg) * mod.healthDrain)
@@ -1065,7 +1065,7 @@ const mobs = {
for (let i = 0, len = consBB.length; i < len; ++i) { for (let i = 0, len = consBB.length; i < len; ++i) {
if (consBB[i].bodyA === this) { if (consBB[i].bodyA === this) {
if (consBB[i].bodyB.shield) { if (consBB[i].bodyB.shield) {
consBB[i].bodyB.do = function () { consBB[i].bodyB.do = function() {
this.death(); this.death();
}; };
} }
@@ -1075,7 +1075,7 @@ const mobs = {
break; break;
} else if (consBB[i].bodyB === this) { } else if (consBB[i].bodyB === this) {
if (consBB[i].bodyA.shield) { if (consBB[i].bodyA.shield) {
consBB[i].bodyA.do = function () { consBB[i].bodyA.do = function() {
this.death(); this.death();
}; };
} }
@@ -1120,7 +1120,7 @@ const mobs = {
//large mobs shrink so they don't block paths //large mobs shrink so they don't block paths
if (body[len].mass > 9) { if (body[len].mass > 9) {
const shrink = function (that, massLimit) { const shrink = function(that, massLimit) {
if (that.mass > massLimit) { if (that.mass > massLimit) {
const scale = 0.95; const scale = 0.95;
Matter.Body.scale(that, scale, scale); Matter.Body.scale(that, scale, scale);

View File

@@ -92,7 +92,7 @@ const mod = {
if (mod.restDamage > 1 && player.speed < 1) dmg *= mod.restDamage if (mod.restDamage > 1 && player.speed < 1) dmg *= mod.restDamage
if (mod.isEnergyDamage) dmg *= 1 + mech.energy / 5.5; if (mod.isEnergyDamage) dmg *= 1 + mech.energy / 5.5;
if (mod.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038 if (mod.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038
if (mod.isRerollDamage) dmg *= 1 + 0.06 * powerUps.reroll.rerolls if (mod.isRerollDamage) dmg *= 1 + 0.05 * powerUps.reroll.rerolls
if (mod.isOneGun && b.inventory.length < 2) dmg *= 1.25 if (mod.isOneGun && b.inventory.length < 2) dmg *= 1.25
if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.5 if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.5
return dmg * mod.slowFire * mod.aimDamage return dmg * mod.slowFire * mod.aimDamage
@@ -245,7 +245,7 @@ const mod = {
}, },
{ {
name: "perturbation theory", name: "perturbation theory",
description: "increase <strong class='color-d'>damage</strong> by <strong>6%</strong><br>for each of your <strong class='color-r'>rerolls</strong>", description: "increase <strong class='color-d'>damage</strong> by <strong>5%</strong><br>for each of your <strong class='color-r'>rerolls</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -934,7 +934,7 @@ const mod = {
}, },
{ {
name: "piezoelectricity", name: "piezoelectricity",
description: "<strong>colliding</strong> with mobs fills your <strong class='color-f'>energy</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>", description: "<strong>colliding</strong> with mobs overfills <strong class='color-f'>energy</strong> by <strong>300%</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -943,7 +943,7 @@ const mod = {
requires: "not mass-energy equivalence", requires: "not mass-energy equivalence",
effect() { effect() {
mod.isPiezo = true; mod.isPiezo = true;
mech.energy = mech.maxEnergy; if (mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3;
}, },
remove() { remove() {
mod.isPiezo = false; mod.isPiezo = false;
@@ -1042,7 +1042,7 @@ const mod = {
}, },
{ {
name: "energy conservation", name: "energy conservation",
description: "<strong>10%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>", description: "<strong>7%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>",
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -1050,7 +1050,7 @@ const mod = {
}, },
requires: "", requires: "",
effect() { effect() {
mod.energySiphon += 0.1; mod.energySiphon += 0.07;
}, },
remove() { remove() {
mod.energySiphon = 0; mod.energySiphon = 0;
@@ -1058,7 +1058,7 @@ const mod = {
}, },
{ {
name: "waste energy recovery", name: "waste energy recovery",
description: "if a mob has <strong>died</strong> in the last <strong>5 seconds</strong><br>regen <strong>6%</strong> of max <strong class='color-f'>energy</strong> every second", description: "if a mob has <strong>died</strong> in the last <strong>5 seconds</strong><br>regen <strong>5%</strong> of max <strong class='color-f'>energy</strong> every second",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1182,7 +1182,7 @@ const mod = {
powerUps.reroll.changeRerolls(0) powerUps.reroll.changeRerolls(0)
}, 1000); }, 1000);
}, },
description: "instead of <strong>dying</strong> consume a <strong class='color-r'>reroll</strong><br>and spawn <strong>4</strong> <strong class='color-h'>heal</strong> power ups", description: "consume a <strong class='color-r'>reroll</strong> to avoid <strong>dying</strong> once a level <br>and spawn <strong>6</strong> <strong class='color-h'>heal</strong> power ups",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1191,6 +1191,7 @@ const mod = {
requires: "at least 1 reroll", requires: "at least 1 reroll",
effect() { effect() {
mod.isDeathAvoid = true; mod.isDeathAvoid = true;
mod.isDeathAvoidedThisLevel = false;
setTimeout(function() { setTimeout(function() {
powerUps.reroll.changeRerolls(0) powerUps.reroll.changeRerolls(0)
}, 1000); }, 1000);
@@ -2432,7 +2433,7 @@ const mod = {
} }
}, },
{ {
name: "beam splitter", name: "diffraction grating",
description: `your <strong>laser</strong> gains <strong>2 diverging</strong> beams<br>decrease laser <strong class='color-d'>damage</strong> by <strong>10%</strong>`, description: `your <strong>laser</strong> gains <strong>2 diverging</strong> beams<br>decrease laser <strong class='color-d'>damage</strong> by <strong>10%</strong>`,
maxCount: 9, maxCount: 9,
count: 0, count: 0,
@@ -3098,6 +3099,7 @@ const mod = {
isHealthRecovery: null, isHealthRecovery: null,
isEnergyLoss: null, isEnergyLoss: null,
isDeathAvoid: null, isDeathAvoid: null,
isDeathAvoidedThisLevel: null,
waveSpeedMap: null, waveSpeedMap: null,
waveSpeedBody: null, waveSpeedBody: null,
isSporeField: null, isSporeField: null,

View File

@@ -498,11 +498,15 @@ const mech = {
if (mod.isEnergyHealth) { if (mod.isEnergyHealth) {
mech.energy -= dmg; mech.energy -= dmg;
if (mech.energy < 0 || isNaN(mech.energy)) { //taking deadly damage if (mech.energy < 0 || isNaN(mech.energy)) { //taking deadly damage
if (mod.isDeathAvoid && powerUps.reroll.rerolls) { if (mod.isDeathAvoid && powerUps.reroll.rerolls && !mod.isDeathAvoidedThisLevel) {
mod.isDeathAvoidedThisLevel = true
powerUps.reroll.changeRerolls(-1) powerUps.reroll.changeRerolls(-1)
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420) game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420)
for (let i = 0; i < 6; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false);
}
mech.energy = mech.maxEnergy mech.energy = mech.maxEnergy
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds mech.immuneCycle = mech.cycle + 360 //disable this.immuneCycle bonus seconds
game.wipe = function() { //set wipe to have trails game.wipe = function() { //set wipe to have trails
ctx.fillStyle = "rgba(255,255,255,0.03)"; ctx.fillStyle = "rgba(255,255,255,0.03)";
ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -511,7 +515,7 @@ const mech = {
game.wipe = function() { //set wipe to normal game.wipe = function() { //set wipe to normal
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
} }
}, 2000); }, 3000);
return; return;
} else { //death } else { //death
@@ -525,14 +529,15 @@ const mech = {
dmg *= mech.harmReduction() dmg *= mech.harmReduction()
mech.health -= dmg; mech.health -= dmg;
if (mech.health < 0 || isNaN(mech.health)) { if (mech.health < 0 || isNaN(mech.health)) {
if (mod.isDeathAvoid && powerUps.reroll.rerolls > 0) { //&& Math.random() < 0.5 if (mod.isDeathAvoid && powerUps.reroll.rerolls > 0 && !mod.isDeathAvoidedThisLevel) { //&& Math.random() < 0.5
mod.isDeathAvoidedThisLevel = true
mech.health = 0.05 mech.health = 0.05
powerUps.reroll.changeRerolls(-1) powerUps.reroll.changeRerolls(-1)
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420) game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420)
for (let i = 0; i < 4; i++) { for (let i = 0; i < 6; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false); powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false);
} }
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds mech.immuneCycle = mech.cycle + 360 //disable this.immuneCycle bonus seconds
// game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420) // game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420)
game.wipe = function() { //set wipe to have trails game.wipe = function() { //set wipe to have trails
@@ -543,7 +548,7 @@ const mech = {
game.wipe = function() { //set wipe to normal game.wipe = function() { //set wipe to normal
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
} }
}, 2000); }, 3000);
} else { } else {
mech.health = 0; mech.health = 0;
mech.death(); mech.death();
@@ -1038,7 +1043,7 @@ const mech = {
if (mech.energy < 0) { if (mech.energy < 0) {
mech.energy = 0; mech.energy = 0;
} }
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy; // if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy;
if (mod.blockDmg) { if (mod.blockDmg) {
who.damage(mod.blockDmg * b.dmgScale) who.damage(mod.blockDmg * b.dmgScale)
@@ -1709,7 +1714,7 @@ const mech = {
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(180); mech.lookForPickUp(180);
const DRAIN = 0.0008 const DRAIN = 0.0011
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
if (mech.energy < DRAIN) { if (mech.energy < DRAIN) {
@@ -1719,11 +1724,9 @@ const mech = {
} }
//draw field everywhere //draw field everywhere
ctx.globalCompositeOperation = "saturation" ctx.globalCompositeOperation = "saturation"
// ctx.fillStyle = "rgba(100,200,230," + (0.25 + 0.06 * Math.random()) + ")";
ctx.fillStyle = "#ccc"; ctx.fillStyle = "#ccc";
ctx.fillRect(-100000, -100000, 200000, 200000) ctx.fillRect(-100000, -100000, 200000, 200000)
ctx.globalCompositeOperation = "source-over" ctx.globalCompositeOperation = "source-over"
//stop time //stop time
mech.isBodiesAsleep = true; mech.isBodiesAsleep = true;

View File

@@ -94,17 +94,17 @@ const spawn = {
me.frictionAir = 0.01; me.frictionAir = 0.01;
me.memory = Infinity; me.memory = Infinity;
me.locatePlayer(); me.locatePlayer();
const density = 5 const density = 1
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
spawn.shield(me, x, y, 1); // spawn.shield(me, x, y, 1);
me.onDeath = function() { me.onDeath = function() {
level.bossKilled = true; level.bossKilled = true;
level.exit.x = 5500; level.exit.x = 5500;
level.exit.y = -330; level.exit.y = -330;
}; };
me.onDamage = function() {}; me.onDamage = function() {};
me.cycle = 300; me.cycle = 420;
me.endCycle = 600; me.endCycle = 720;
me.mode = 0; me.mode = 0;
me.do = function() { me.do = function() {
//hold position //hold position
@@ -118,9 +118,9 @@ const spawn = {
}); });
this.modeDo(); //this does different things based on the mode this.modeDo(); //this does different things based on the mode
this.checkStatus(); this.checkStatus();
if (!mech.isBodiesAsleep) { this.cycle++; //switch modes÷
this.cycle++; //switch modes // if (!mech.isBodiesAsleep) {
if (this.health > 0.33) { if (this.health > 0.25) {
if (this.cycle > this.endCycle) { if (this.cycle > this.endCycle) {
this.cycle = 0; this.cycle = 0;
this.mode++ this.mode++
@@ -139,21 +139,19 @@ const spawn = {
} else { } else {
body[i].force.x = -0.5 body[i].force.x = -0.5
} }
} }
} else if (this.mode === 1) { } else if (this.mode === 1) {
this.fill = "rgb(150,150,255)"; this.fill = "#50f"; // this.fill = "rgb(150,150,255)";
this.endCycle = 360
this.modeDo = this.modeSpawns this.modeDo = this.modeSpawns
} else if (this.mode === 2) { } else if (this.mode === 2) {
this.fill = "#000"; this.fill = "#000";
this.endCycle = 720
this.modeDo = this.modeSuck this.modeDo = this.modeSuck
Matter.Body.scale(this, 0.1, 0.1); Matter.Body.scale(this, 0.1, 0.1);
Matter.Body.setDensity(me, 100 * density); //extra dense //normal is 0.001 //makes effective life much larger Matter.Body.setDensity(me, 100 * density); //extra dense //normal is 0.001 //makes effective life much larger
} }
} }
} else if (this.mode !== 3) { //all three modes at once } else if (this.mode !== 3) { //all three modes at once
this.cycle = 0;
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
if (this.mode === 2) { if (this.mode === 2) {
Matter.Body.scale(this, 5, 5); Matter.Body.scale(this, 5, 5);
@@ -167,7 +165,7 @@ const spawn = {
if (!this.isShielded) spawn.shield(this, x, y, 1); //regen shield here ? if (!this.isShielded) spawn.shield(this, x, y, 1); //regen shield here ?
this.modeDo = this.modeAll this.modeDo = this.modeAll
} }
} // }
}; };
me.modeDo = function() {} me.modeDo = function() {}
me.modeAll = function() { me.modeAll = function() {
@@ -176,25 +174,32 @@ const spawn = {
this.modeLasers() this.modeLasers()
} }
me.modeSpawns = function() { me.modeSpawns = function() {
if (!(this.cycle % 320) && !mech.isBodiesAsleep && mob.length < 40) { if ((this.cycle === 2 || this.cycle === 300) && !mech.isBodiesAsleep && mob.length < 40) {
Matter.Body.setAngularVelocity(this, 0.11) Matter.Body.setAngularVelocity(this, 0.1)
//fire a bullet from each vertex //fire a bullet from each vertex
for (let i = 0, len = this.vertices.length; i < len; i++) { for (let i = 0, len = this.vertices.length; i < len; i++) {
let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)]; let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)];
spawn[whoSpawn](this.vertices[i].x, this.vertices[i].y); spawn[whoSpawn](this.vertices[i].x, this.vertices[i].y);
//give the bullet a rotational velocity as if they were attached to a vertex //give the bullet a rotational velocity as if they were attached to a vertex
const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, this.vertices[i]))), -20) const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, this.vertices[i]))), -18)
Matter.Body.setVelocity(mob[mob.length - 1], { Matter.Body.setVelocity(mob[mob.length - 1], {
x: this.velocity.x + velocity.x, x: this.velocity.x + velocity.x,
y: this.velocity.y + velocity.y y: this.velocity.y + velocity.y
}); });
} }
if (game.difficulty > 60) {
spawn.randomLevelBoss(3000, -1100)
if (game.difficulty > 100) {
spawn.randomLevelBoss(3000, -1300)
} }
} }
me.eventHorizon = 1400 }
}
me.eventHorizon = 1300
me.eventHorizonCycleRate = 4 * Math.PI / me.endCycle
me.modeSuck = function() { me.modeSuck = function() {
//eventHorizon waves in and out //eventHorizon waves in and out
eventHorizon = this.eventHorizon * (1 + 0.2 * Math.sin(game.cycle * 0.015)) if (!mech.isBodiesAsleep) eventHorizon = this.eventHorizon * (1 - 0.25 * Math.cos(this.cycle * this.eventHorizonCycleRate)) //0.014
//draw darkness //draw darkness
ctx.beginPath(); ctx.beginPath();
ctx.arc(this.position.x, this.position.y, eventHorizon * 0.2, 0, 2 * Math.PI); ctx.arc(this.position.x, this.position.y, eventHorizon * 0.2, 0, 2 * Math.PI);
@@ -242,8 +247,7 @@ const spawn = {
me.rotateVelocity = 0.0025 me.rotateVelocity = 0.0025
me.rotateCount = 0; me.rotateCount = 0;
me.modeLasers = function() { me.modeLasers = function() {
if (!this.isStunned) { if (!mech.isBodiesAsleep && !this.isStunned) {
if (!mech.isBodiesAsleep) {
let slowed = false //check if slowed let slowed = false //check if slowed
for (let i = 0; i < this.status.length; i++) { for (let i = 0; i < this.status.length; i++) {
if (this.status[i].type === "slow") { if (this.status[i].type === "slow") {
@@ -258,7 +262,7 @@ const spawn = {
Matter Matter
} }
} }
if (this.cycle < 180) { //damage scales up over 2 seconds to give player time to move if (this.cycle < 240) { //damage scales up over 2 seconds to give player time to move
const scale = this.cycle / 180 const scale = this.cycle / 180
const dmg = 0.14 * game.dmgScale * scale const dmg = 0.14 * game.dmgScale * scale
ctx.beginPath(); ctx.beginPath();
@@ -293,7 +297,6 @@ const spawn = {
ctx.strokeStyle = "rgba(80,0,255,0.07)"; ctx.strokeStyle = "rgba(80,0,255,0.07)";
ctx.stroke(); // Draw it ctx.stroke(); // Draw it
} }
}
me.laser = function(where, angle, dmg = 0.14 * game.dmgScale) { me.laser = function(where, angle, dmg = 0.14 * game.dmgScale) {
const vertexCollision = function(v1, v1End, domain) { const vertexCollision = function(v1, v1End, domain) {
for (let i = 0; i < domain.length; ++i) { for (let i = 0; i < domain.length; ++i) {

View File

@@ -1,31 +1,34 @@
missile moves slightly differently
it used to slow when locked on to a target
now it slows when turning
missiles explode when near any mob
wormhole mod: cosmic string - now stuns mobs and applies radiation damage update to mod: anthropic principle - only works once per level
mod time dilation: - quadruple your default energy regeneration but gives 6 seconds of damage immunity and 2 extra heal power ups
added final boss level, it's still in progress so I'd love some feedback most energy regeneration effects now overfill energy above the max by default
also the game loops back to the intro level after the boss piezo electricity over fills energy by 300% (was 100%)
I'll be working on the ending in the next patch, so the intro level is just a placeholder
************** TODO - n-gon ************** ************** TODO - n-gon **************
final boss has elements of other bosses add an ending to the game
laser mode maybe the game ending should ask you to open the console and type in some commands
if player is on left rotate counter clockwise mirror ending (if no cheats)
if player is on right rotate clockwise level after final boss battle is the intro level, but flipped left right, with a fake player
start of laser mode damage the fake player to end the game
push block either left or right, not away message about go outside
vibrating shape no ending (if cheats)
grow and shrink game goes on forever
oscillate elliptical deformation (not sure how) also game goes on if player attacks, the fake player
game never ends if you have used cheats
laser mod - your laser beam fires from your last position, not your current position
or apply to all guns?
mod: While in the air, time is slowed.
or something else while in air
a bot that eats ammo and converts them into rerolls a bot that eats ammo and converts them into rerolls
or 2 ammo power ups = 1 reroll or 2 ammo power ups = 1 reroll
been getting some fps slow down after playing for a few minutes been getting some fps slow down after playing for a few minutes
this seems to be caused by capping the fps at 60, but 60 fps shouldn't have any slowdown
new status effect: fear - push mob away from player for a time new status effect: fear - push mob away from player for a time
@@ -47,17 +50,6 @@ mod - explosions apply radiation damage over time
mod self destruct - drones explode when they die mod self destruct - drones explode when they die
drones lose extra time on collisions drones lose extra time on collisions
add an ending to the game
add a final boss battle level
mirror ending (if no cheats)
level after final boss battle is the intro level, but flipped left right, with a fake player
damage the fake player to end the game
message about go outside
no ending (if cheats)
game goes on forever
also game goes on if player attacks, the fake player
game never ends if you have used cheats
foam or spore bullet on dmg shrink effect foam or spore bullet on dmg shrink effect
it might mess with the foam position of other bullets on the mob it might mess with the foam position of other bullets on the mob
shrink when foam bullets end while attached, or shrink on collision? shrink when foam bullets end while attached, or shrink on collision?