added quantum immortaility
This commit is contained in:
@@ -33,9 +33,7 @@
|
|||||||
|
|
||||||
<!-- <body oncontextmenu="return false"> -->
|
<!-- <body oncontextmenu="return false"> -->
|
||||||
<div id='guns'></div>
|
<div id='guns'></div>
|
||||||
<div id='mods'>
|
<div id='mods'></div>
|
||||||
Auto-Loading Heuristics
|
|
||||||
</div>
|
|
||||||
<div id="text-log"></div>
|
<div id="text-log"></div>
|
||||||
<div id="fade-out"></div>
|
<div id="fade-out"></div>
|
||||||
<div id="health-bg"></div>
|
<div id="health-bg"></div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const b = {
|
|||||||
modHealthDrain: null,
|
modHealthDrain: null,
|
||||||
modNoAmmo: null,
|
modNoAmmo: null,
|
||||||
modBulletsLastLonger: null,
|
modBulletsLastLonger: null,
|
||||||
// modNonEuclidean: null,
|
modIsImmortal: null,
|
||||||
setModDefaults() {
|
setModDefaults() {
|
||||||
b.modFireRate = 1;
|
b.modFireRate = 1;
|
||||||
b.modExplosionRadius = 1;
|
b.modExplosionRadius = 1;
|
||||||
@@ -21,15 +21,15 @@ const b = {
|
|||||||
b.modHealthDrain = 0;
|
b.modHealthDrain = 0;
|
||||||
b.modNoAmmo = 0;
|
b.modNoAmmo = 0;
|
||||||
b.modBulletsLastLonger = 1;
|
b.modBulletsLastLonger = 1;
|
||||||
// b.modNonEuclidean = false;
|
b.modIsImmortal = false;
|
||||||
},
|
},
|
||||||
modText: function () {
|
modText() {
|
||||||
game.makeTextLog(`<strong style='font-size:30px;'>${b.mods[b.mod].name}</strong><br> <span class='faded'>(left click)</span><p>${b.mods[b.mod].description}</p>`, 1200);
|
if (b.mod !== null) game.makeTextLog(`<strong style='font-size:30px;'>${b.mods[b.mod].name}</strong><br> <p>${b.mods[b.mod].description}</p>`, 1200);
|
||||||
document.getElementById("mods").innerHTML = b.mods[b.mod].name
|
game.updateModHUD()
|
||||||
},
|
},
|
||||||
mods: [{
|
mods: [{
|
||||||
name: "Auto-Loading Heuristics",
|
name: "Auto-Loading Heuristics",
|
||||||
description: "your <strong>rate of fire</strong> 15% is faster",
|
description: "your <strong>rate of fire</strong> is 15% faster",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.mod = 0
|
b.mod = 0
|
||||||
b.modText();
|
b.modText();
|
||||||
@@ -40,7 +40,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Anti-Matter Cores",
|
name: "Anti-Matter Cores",
|
||||||
description: "your <strong>explosions</strong> are larger and do more damage",
|
description: "your <strong>explosions</strong> are larger and more dangerous",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.mod = 1
|
b.mod = 1
|
||||||
b.modText();
|
b.modText();
|
||||||
@@ -68,7 +68,7 @@ const b = {
|
|||||||
effect: () => {
|
effect: () => {
|
||||||
b.mod = 3
|
b.mod = 3
|
||||||
b.modText();
|
b.modText();
|
||||||
b.setModDefaults(); //good with laser, Nano-Scale Manufacturing, Standing Wave Harmonics, Phase Decoherence Field
|
b.setModDefaults(); //good with laser, and all fields
|
||||||
b.modEnergySiphon = 0.2;
|
b.modEnergySiphon = 0.2;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -93,26 +93,26 @@ const b = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Anti-Decay Coating",
|
name: "Decay Resistant Topology",
|
||||||
description: "your bullets <strong>last 25% longer</strong>",
|
description: "your bullets <strong>last 30% longer</strong>",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.mod = 6
|
b.mod = 6
|
||||||
b.modText();
|
b.modText();
|
||||||
b.setModDefaults(); //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
b.setModDefaults(); //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
||||||
b.modBulletsLastLonger = 1.25
|
b.modBulletsLastLonger = 1.30
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// name: "Non-Euclidean Geometry",
|
name: "Quantum Immortality",
|
||||||
// description: "after you fall loop back to the top of the map",
|
description: "after you die continue in an alternate reality with randomized abilities<br>",
|
||||||
// have: false,
|
effect: () => {
|
||||||
// effect: () => {
|
b.mod = 7
|
||||||
// b.mod = 7
|
b.modText();
|
||||||
// b.modText();
|
b.setModDefaults(); //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
||||||
// b.setModDefaults(); //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
b.modIsImmortal = true;
|
||||||
// b.modNonEuclidean = true
|
}
|
||||||
// }
|
},
|
||||||
// },
|
|
||||||
// () => {
|
// () => {
|
||||||
// b.mod = 8;
|
// b.mod = 8;
|
||||||
// game.makeTextLog("<strong style='font-size:30px;'>Relativistic Velocity</strong><br> <span class='faded'>(left click)</span><p>Your bullets are effected extra by your own velocity</p>", 1200);
|
// game.makeTextLog("<strong style='font-size:30px;'>Relativistic Velocity</strong><br> <span class='faded'>(left click)</span><p>Your bullets are effected extra by your own velocity</p>", 1200);
|
||||||
|
|||||||
36
js/game.js
36
js/game.js
@@ -153,6 +153,16 @@ const game = {
|
|||||||
}
|
}
|
||||||
game.boldActiveGunHUD();
|
game.boldActiveGunHUD();
|
||||||
},
|
},
|
||||||
|
updateModHUD() {
|
||||||
|
let text = ""
|
||||||
|
if (mech.fieldMode !== 0) {
|
||||||
|
text += mech.fieldUpgrades[mech.fieldMode].name
|
||||||
|
if (b.mod !== null) text += "<br>" + b.mods[b.mod].name
|
||||||
|
} else if (b.mod !== null) {
|
||||||
|
text += b.mods[b.mod].name
|
||||||
|
}
|
||||||
|
document.getElementById("mods").innerHTML = text
|
||||||
|
},
|
||||||
makeTextLog(text, time = 180) {
|
makeTextLog(text, time = 180) {
|
||||||
document.getElementById("text-log").innerHTML = text;
|
document.getElementById("text-log").innerHTML = text;
|
||||||
document.getElementById("text-log").style.opacity = 1;
|
document.getElementById("text-log").style.opacity = 1;
|
||||||
@@ -250,10 +260,14 @@ const game = {
|
|||||||
requestAnimationFrame(cycle);
|
requestAnimationFrame(cycle);
|
||||||
} else {
|
} else {
|
||||||
game.paused = true;
|
game.paused = true;
|
||||||
let text = "<h1>PAUSED</h1>"
|
game.makeTextLog("<h1>PAUSED</h1>", 1);
|
||||||
// if (b.mod !== null) text+=
|
// let text = "<h1>PAUSED</h1><br><div style='font-size: 85%;'>"
|
||||||
//output current mod, field, and gun info when paused
|
// //output current mod, field, and gun info when paused
|
||||||
game.makeTextLog(text);
|
// if (mech.fieldMode !== 0) text += "<br><p><strong style='font-size:130%;'>" + mech.fieldUpgrades[mech.fieldMode].name + "</strong><br>" + mech.fieldUpgrades[mech.fieldMode].description + "</p>"
|
||||||
|
// if (b.mod !== null) text += "<br><p><strong style='font-size:130%;'>" + b.mods[b.mod].name + "</strong><br>" + b.mods[b.mod].description + "</p>"
|
||||||
|
// if (b.activeGun !== null) text += "<br><p><strong style='font-size:130%;'>" + b.guns[b.activeGun].name + "</strong><br>" + b.guns[b.activeGun].description + "</p>"
|
||||||
|
// text += "</div>"
|
||||||
|
// game.makeTextLog(text, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,9 +284,9 @@ const game = {
|
|||||||
|
|
||||||
if (keys[70]) { //cycle fields with F
|
if (keys[70]) { //cycle fields with F
|
||||||
if (mech.fieldMode === mech.fieldUpgrades.length - 1) {
|
if (mech.fieldMode === mech.fieldUpgrades.length - 1) {
|
||||||
mech.fieldUpgrades[0]()
|
mech.fieldUpgrades[0].effect()
|
||||||
} else {
|
} else {
|
||||||
mech.fieldUpgrades[mech.fieldMode + 1]()
|
mech.fieldUpgrades[mech.fieldMode + 1].effect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keys[71]) { // give all guns with G
|
if (keys[71]) { // give all guns with G
|
||||||
@@ -361,8 +375,11 @@ const game = {
|
|||||||
},
|
},
|
||||||
wipe() {
|
wipe() {
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
// ctx.fillStyle = "#000";
|
|
||||||
|
// ctx.fillStyle = "rgba(255,255,255,1)";
|
||||||
|
// ctx.globalCompositeOperation = "difference";
|
||||||
// ctx.fillRect(0, 0, canvas.width, canvas.height);
|
// ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
// ctx.globalCompositeOperation = "source-over";
|
||||||
|
|
||||||
// ctx.globalAlpha = (mech.health < 0.7) ? (mech.health+0.3)*(mech.health+0.3) : 1
|
// ctx.globalAlpha = (mech.health < 0.7) ? (mech.health+0.3)*(mech.health+0.3) : 1
|
||||||
// if (mech.health < 0.7) {
|
// if (mech.health < 0.7) {
|
||||||
@@ -393,11 +410,11 @@ const game = {
|
|||||||
b.guns[i].have = false;
|
b.guns[i].have = false;
|
||||||
if (b.guns[i].ammo != Infinity) b.guns[i].ammo = 0;
|
if (b.guns[i].ammo != Infinity) b.guns[i].ammo = 0;
|
||||||
}
|
}
|
||||||
|
b.activeGun = null;
|
||||||
game.paused = false;
|
game.paused = false;
|
||||||
engine.timing.timeScale = 1;
|
engine.timing.timeScale = 1;
|
||||||
game.dmgScale = 1;
|
game.dmgScale = 1;
|
||||||
b.dmgScale = 0.7;
|
b.dmgScale = 0.7;
|
||||||
b.activeGun = null;
|
|
||||||
game.makeGunHUD();
|
game.makeGunHUD();
|
||||||
mech.drop();
|
mech.drop();
|
||||||
mech.addHealth(1);
|
mech.addHealth(1);
|
||||||
@@ -408,8 +425,7 @@ const game = {
|
|||||||
document.getElementById("text-log").style.opacity = 0;
|
document.getElementById("text-log").style.opacity = 0;
|
||||||
document.getElementById("fade-out").style.opacity = 0;
|
document.getElementById("fade-out").style.opacity = 0;
|
||||||
document.title = "n-gon";
|
document.title = "n-gon";
|
||||||
// mech.fieldUpgrades[0](); //reset to starting field? or let them keep the field
|
if (!mech.fieldMode) mech.fieldUpgrades[0].effect(); //reset to starting field? or let them keep the field
|
||||||
if (!mech.fieldMode) mech.fieldUpgrades[0](); //reset to starting field? or let them keep the field
|
|
||||||
},
|
},
|
||||||
firstRun: true,
|
firstRun: true,
|
||||||
splashReturn() {
|
splashReturn() {
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
/* TODO: *******************************************
|
/* TODO: *******************************************
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
||||||
|
make player legs just slide if the player is above the normal speed
|
||||||
|
like when you fire the one shot
|
||||||
|
|
||||||
make power ups keep moving to player if the field is turned off
|
make power ups keep moving to player if the field is turned off
|
||||||
|
|
||||||
levels spawn by having the map aspects randomly fly into place
|
levels spawn by having the map aspects randomly fly into place
|
||||||
|
|||||||
12
js/level.js
12
js/level.js
@@ -12,11 +12,11 @@ const level = {
|
|||||||
onLevel: 0,
|
onLevel: 0,
|
||||||
start() {
|
start() {
|
||||||
if (game.levelsCleared === 0) {
|
if (game.levelsCleared === 0) {
|
||||||
// game.levelsCleared = 5; //for testing to simulate possible mobs spawns
|
// game.levelsCleared = 6; //for testing to simulate possible mobs spawns
|
||||||
// b.giveGuns("all", 1000)
|
// b.giveGuns("all", 1000)
|
||||||
// b.giveGuns(3) // set a starting gun for testing
|
// b.giveGuns(3) // set a starting gun for testing
|
||||||
// mech.fieldUpgrades[2](); //give a field power up for testing
|
// mech.fieldUpgrades[2].effect(); //give a field power up for testing
|
||||||
// b.mods[6].effect(); //give specific mod
|
// b.mods[7].effect(); //give specific mod
|
||||||
|
|
||||||
this.intro(); //starting level
|
this.intro(); //starting level
|
||||||
// this.testingMap();
|
// this.testingMap();
|
||||||
@@ -28,11 +28,11 @@ const level = {
|
|||||||
// this.office();
|
// this.office();
|
||||||
} else {
|
} else {
|
||||||
spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns
|
spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns
|
||||||
this[this.levels[this.onLevel]](); //picks the current map from the the levels array
|
level[level.levels[level.onLevel]](); //picks the current map from the the levels array
|
||||||
this.levelAnnounce();
|
level.levelAnnounce();
|
||||||
}
|
}
|
||||||
game.setZoom();
|
game.setZoom();
|
||||||
this.addToWorld(); //add bodies to game engine
|
level.addToWorld(); //add bodies to game engine
|
||||||
game.draw.setPaths();
|
game.draw.setPaths();
|
||||||
},
|
},
|
||||||
difficultyIncrease() {
|
difficultyIncrease() {
|
||||||
|
|||||||
130
js/player.js
130
js/player.js
@@ -358,7 +358,61 @@ const mech = {
|
|||||||
},
|
},
|
||||||
alive: true,
|
alive: true,
|
||||||
death() {
|
death() {
|
||||||
if (this.alive) {
|
if (b.modIsImmortal) { //if player has the immortality buff, spawn on the same level with randomized stats
|
||||||
|
//remove mod
|
||||||
|
b.mod = null
|
||||||
|
b.setModDefaults();
|
||||||
|
b.modText();
|
||||||
|
|
||||||
|
//randomize guns
|
||||||
|
b.activeGun = null;
|
||||||
|
b.inventory = []; //removes guns and ammo
|
||||||
|
for (let i = 0, len = b.guns.length; i < len; ++i) {
|
||||||
|
b.guns[i].have = false;
|
||||||
|
if (b.guns[i].ammo != Infinity) b.guns[i].ammo = 0;
|
||||||
|
}
|
||||||
|
if (game.levelsCleared > 0) powerUps.gun.effect();
|
||||||
|
if (game.levelsCleared > 1) powerUps.gun.effect();
|
||||||
|
if (game.levelsCleared > 3) powerUps.gun.effect();
|
||||||
|
if (game.levelsCleared > 6) powerUps.gun.effect();
|
||||||
|
game.makeGunHUD();
|
||||||
|
|
||||||
|
//randomize field
|
||||||
|
|
||||||
|
if (game.levelsCleared > 5) {
|
||||||
|
mech.fieldUpgrades[Math.floor(Math.random() * (mech.fieldUpgrades.length))].effect();
|
||||||
|
} else {
|
||||||
|
mech.fieldUpgrades[0].effect();
|
||||||
|
}
|
||||||
|
|
||||||
|
mech.addHealth(1);
|
||||||
|
spawn.setSpawnList();
|
||||||
|
game.clearNow = true;
|
||||||
|
|
||||||
|
game.wipe = function () { //set wipe to have trails
|
||||||
|
ctx.fillStyle = "rgba(255,255,255,0.01)";
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < 7; i++) {
|
||||||
|
setTimeout(function () {
|
||||||
|
game.makeTextLog(`<div style='opacity:0.3;'> probability amplitude will synchronize in ${7-i} seconds</div>`, 1000);
|
||||||
|
game.wipe = function () { //set wipe to have trails
|
||||||
|
ctx.fillStyle = `rgba(255,255,255,${(i+1)*0.04})`;
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
}
|
||||||
|
}, (i + 1) * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
game.wipe = function () { //set wipe to normal
|
||||||
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
}
|
||||||
|
game.makeTextLog("<div style='opacity:0.5;'><strong>Quantum Immortality</strong> has stabilized your probability amplitude<br>welcome to your new reality</div>", 1000);
|
||||||
|
document.title = "n-gon: L" + (game.levelsCleared) + " " + level.levels[level.onLevel] + " version 2";
|
||||||
|
}, 8000);
|
||||||
|
|
||||||
|
} else if (this.alive) { //normal death code here
|
||||||
this.alive = false;
|
this.alive = false;
|
||||||
game.paused = true;
|
game.paused = true;
|
||||||
this.health = 0;
|
this.health = 0;
|
||||||
@@ -844,10 +898,17 @@ const mech = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
hold() {},
|
hold() {},
|
||||||
fieldUpgrades: [
|
fieldText() {
|
||||||
() => {
|
game.makeTextLog(`<strong style='font-size:30px;'>${mech.fieldUpgrades[mech.fieldMode].name}</strong><br> <span class='faded'>(right click or space bar)</span><p>${mech.fieldUpgrades[mech.fieldMode].description}</p>`, 1200);
|
||||||
|
game.updateModHUD()
|
||||||
|
},
|
||||||
|
fieldUpgrades: [{
|
||||||
|
name: "Field Emitter",
|
||||||
|
description: "lets you <strong>pick up</strong> and throw objects<br><strong>shields</strong> you from damage",
|
||||||
|
effect: () => {
|
||||||
mech.fieldMode = 0;
|
mech.fieldMode = 0;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Field Emitter</strong><br> <span class='faded'>(right click or space bar)</span><p>lets you <strong>pick up</strong> and throw objects<br><strong>shields</strong> you from damage</p>", 1200);
|
mech.fieldText();
|
||||||
|
// game.makeTextLog("<strong style='font-size:30px;'></strong><br> <span class='faded'>(right click or space bar)</span><p></p>", 1200);
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
@@ -866,10 +927,14 @@ const mech = {
|
|||||||
}
|
}
|
||||||
mech.drawFieldMeter()
|
mech.drawFieldMeter()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
|
name: "Time Dilation Field",
|
||||||
|
description: "<strong>stop time</strong> while field is active<br> can fire while field is active",
|
||||||
|
effect: () => {
|
||||||
mech.fieldMode = 1;
|
mech.fieldMode = 1;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Time Dilation Field</strong><br> <span class='faded'>(right click or space bar)</span><p> <strong>stop time</strong> while field is active<br> can fire while field is active</p>", 1200);
|
mech.fieldText();
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
mech.fieldFire = true;
|
mech.fieldFire = true;
|
||||||
mech.grabRange = 130
|
mech.grabRange = 130
|
||||||
@@ -881,7 +946,7 @@ const mech = {
|
|||||||
mech.holding();
|
mech.holding();
|
||||||
mech.throw();
|
mech.throw();
|
||||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
||||||
const DRAIN = 0.0022
|
const DRAIN = 0.0027
|
||||||
if (mech.fieldMeter > DRAIN) {
|
if (mech.fieldMeter > DRAIN) {
|
||||||
mech.fieldMeter -= DRAIN;
|
mech.fieldMeter -= DRAIN;
|
||||||
|
|
||||||
@@ -933,10 +998,14 @@ const mech = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
|
name: "Electrostatic Force Field",
|
||||||
|
description: "field does <strong>damage</strong> on contact<br> blocks are thrown at a higher velocity<br> increased field regeneration",
|
||||||
|
effect: () => {
|
||||||
mech.fieldMode = 2;
|
mech.fieldMode = 2;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Electrostatic Force Field</strong><br> <span class='faded'>(right click or space bar)</span><p> field does <strong>damage</strong> on contact<br> blocks are thrown at a higher velocity<br> increased field regeneration</p>", 1200);
|
mech.fieldText();
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
//throw quicker and harder
|
//throw quicker and harder
|
||||||
mech.grabRange = 225;
|
mech.grabRange = 225;
|
||||||
@@ -1002,10 +1071,14 @@ const mech = {
|
|||||||
}
|
}
|
||||||
mech.drawFieldMeter()
|
mech.drawFieldMeter()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
|
name: "Negative Mass Field",
|
||||||
|
description: "field nullifies <strong>gravity</strong><br> player can hold more massive objects<br>can fire while field is active",
|
||||||
|
effect: () => {
|
||||||
mech.fieldMode = 3;
|
mech.fieldMode = 3;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Negative Mass Field</strong><br> <span class='faded'>(right click or space bar)</span><p> field nullifies <strong>gravity</strong><br> player can hold more massive objects<br>can fire while field is active</p>", 1200);
|
mech.fieldText();
|
||||||
//<br> <span style='color:#a00;'>decreased</span> field shielding efficiency
|
//<br> <span style='color:#a00;'>decreased</span> field shielding efficiency
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
mech.fieldFire = true;
|
mech.fieldFire = true;
|
||||||
@@ -1018,7 +1091,7 @@ const mech = {
|
|||||||
mech.holding();
|
mech.holding();
|
||||||
mech.throw();
|
mech.throw();
|
||||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
|
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
|
||||||
const DRAIN = 0.0007
|
const DRAIN = 0.0006
|
||||||
if (mech.fieldMeter > DRAIN) {
|
if (mech.fieldMeter > DRAIN) {
|
||||||
mech.pushMobs360(170);
|
mech.pushMobs360(170);
|
||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
@@ -1084,10 +1157,14 @@ const mech = {
|
|||||||
}
|
}
|
||||||
mech.drawFieldMeter()
|
mech.drawFieldMeter()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
|
name: "Standing Wave Harmonics",
|
||||||
|
description: "oscillating shields always surround player<br> <span style='color:#a00;'>decreased</span> field regeneration",
|
||||||
|
effect: () => {
|
||||||
mech.fieldMode = 4;
|
mech.fieldMode = 4;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Standing Wave Harmonics</strong><br> <span class='faded'>(right click or space bar)</span> <p>oscillating shields always surround player<br> <span style='color:#a00;'>decreased</span> field regeneration</p>", 1200);
|
mech.fieldText();
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
// mech.fieldShieldingScale = 0.5;
|
// mech.fieldShieldingScale = 0.5;
|
||||||
mech.fieldRegen *= 0.2;
|
mech.fieldRegen *= 0.2;
|
||||||
@@ -1106,9 +1183,9 @@ const mech = {
|
|||||||
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
||||||
}
|
}
|
||||||
if (mech.fieldMeter > 0.1) {
|
if (mech.fieldMeter > 0.1) {
|
||||||
const grabRange1 = 85 + 60 * Math.sin(mech.cycle / 23)
|
const grabRange1 = 90 + 60 * Math.sin(mech.cycle / 23)
|
||||||
const grabRange2 = 80 + 70 * Math.sin(mech.cycle / 37)
|
const grabRange2 = 85 + 70 * Math.sin(mech.cycle / 37)
|
||||||
const grabRange3 = 70 + 70 * Math.sin(mech.cycle / 47)
|
const grabRange3 = 80 + 80 * Math.sin(mech.cycle / 47)
|
||||||
const netGrabRange = Math.max(grabRange1, grabRange2, grabRange3)
|
const netGrabRange = Math.max(grabRange1, grabRange2, grabRange3)
|
||||||
ctx.fillStyle = "rgba(110,170,200," + (0.15 + 0.15 * Math.random()) + ")";
|
ctx.fillStyle = "rgba(110,170,200," + (0.15 + 0.15 * Math.random()) + ")";
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
@@ -1124,12 +1201,16 @@ const mech = {
|
|||||||
}
|
}
|
||||||
mech.drawFieldMeter()
|
mech.drawFieldMeter()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
|
name: "Nano-Scale Manufacturing",
|
||||||
|
description: "excess field energy used to build <strong>drones</strong><br> increased field regeneration",
|
||||||
|
effect: () => {
|
||||||
mech.fieldMode = 5;
|
mech.fieldMode = 5;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Nano-Scale Manufacturing</strong><br> <span class='faded'>(passive effect)</span> <p>excess field energy used to build <strong>drones</strong><br> increased field regeneration</p>", 1200);
|
mech.fieldText();
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
mech.fieldRegen *= 3;
|
mech.fieldRegen *= 3.5;
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.fieldMeter === 1) {
|
if (mech.fieldMeter === 1) {
|
||||||
mech.fieldMeter -= 0.5;
|
mech.fieldMeter -= 0.5;
|
||||||
@@ -1151,10 +1232,14 @@ const mech = {
|
|||||||
}
|
}
|
||||||
mech.drawFieldMeter()
|
mech.drawFieldMeter()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
|
name: "Phase Decoherence Field",
|
||||||
|
description: "<strong>intangible</strong> while field is active<br>can't see or be seen outside field",
|
||||||
|
effect: () => {
|
||||||
mech.fieldMode = 6;
|
mech.fieldMode = 6;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Phase Decoherence Field</strong><br> <span class='faded'>(right click or space bar)</span> <p><strong>intangible</strong> while field is active<br>can't see or be seen outside field</p>", 1200);
|
mech.fieldText();
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
// mech.grabRange = 230
|
// mech.grabRange = 230
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
@@ -1194,6 +1279,7 @@ const mech = {
|
|||||||
}
|
}
|
||||||
mech.drawFieldMeter()
|
mech.drawFieldMeter()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// () => {
|
// () => {
|
||||||
// mech.fieldMode = 7;
|
// mech.fieldMode = 7;
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ const powerUps = {
|
|||||||
while (mode === mech.fieldMode) {
|
while (mode === mech.fieldMode) {
|
||||||
mode = Math.ceil(Math.random() * (mech.fieldUpgrades.length - 1))
|
mode = Math.ceil(Math.random() * (mech.fieldUpgrades.length - 1))
|
||||||
}
|
}
|
||||||
mech.fieldUpgrades[mode](); //choose random field upgrade that you don't already have
|
mech.fieldUpgrades[mode].effect(); //choose random field upgrade that you don't already have
|
||||||
} else {
|
} else {
|
||||||
mech.fieldUpgrades[this.mode](); //set a predetermined power up
|
mech.fieldUpgrades[this.mode].effect(); //set a predetermined power up
|
||||||
}
|
}
|
||||||
//pop the old field out in case player wants to swap back
|
//pop the old field out in case player wants to swap back
|
||||||
if (previousMode !== 0) {
|
if (previousMode !== 0) {
|
||||||
|
|||||||
12
js/spawn.js
12
js/spawn.js
@@ -491,12 +491,12 @@ const spawn = {
|
|||||||
me.onDeath = function () {
|
me.onDeath = function () {
|
||||||
//applying forces to player doesn't seem to work inside this method, not sure why
|
//applying forces to player doesn't seem to work inside this method, not sure why
|
||||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||||
if (game.levelsCleared > 6) {
|
if (game.levelsCleared > 5) {
|
||||||
for (let i = 0; i < (game.levelsCleared - 5); ++i) {
|
for (let i = 0; i < (game.levelsCleared - 3); ++i) {
|
||||||
spawn.sucker(this.position.x + (Math.random() - 0.5) * radius * 2, this.position.y + (Math.random() - 0.5) * radius * 2, 20);
|
spawn.sucker(this.position.x + (Math.random() - 0.5) * radius * 2, this.position.y + (Math.random() - 0.5) * radius * 2, 70 * Math.random());
|
||||||
Matter.Body.setVelocity(mob[mob.length - 1], {
|
Matter.Body.setVelocity(mob[mob.length - 1], {
|
||||||
x: (Math.random() - 0.5) * 25,
|
x: (Math.random() - 0.5) * 70,
|
||||||
y: (Math.random() - 0.5) * 25
|
y: (Math.random() - 0.5) * 70
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -540,7 +540,7 @@ const spawn = {
|
|||||||
ctx.fill();
|
ctx.fill();
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(this.position.x, this.position.y, eventHorizon, 0, 2 * Math.PI);
|
ctx.arc(this.position.x, this.position.y, eventHorizon, 0, 2 * Math.PI);
|
||||||
ctx.fillStyle = "rgba(0,20,40,0.05)";
|
ctx.fillStyle = "rgba(0,0,0,0.05)";
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
//when player is inside event horizon
|
//when player is inside event horizon
|
||||||
if (Matter.Vector.magnitude(Matter.Vector.sub(this.position, player.position)) < eventHorizon) {
|
if (Matter.Vector.magnitude(Matter.Vector.sub(this.position, player.position)) < eventHorizon) {
|
||||||
|
|||||||
24
style.css
24
style.css
@@ -68,8 +68,8 @@ summary {
|
|||||||
|
|
||||||
#health-bg {
|
#health-bg {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 30px;
|
top: 15px;
|
||||||
left: 40px;
|
left: 15px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
@@ -81,8 +81,8 @@ summary {
|
|||||||
|
|
||||||
#health {
|
#health {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 30px;
|
top: 15px;
|
||||||
left: 40px;
|
left: 15px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
width: 0px;
|
width: 0px;
|
||||||
transition: width 1s ease-out;
|
transition: width 1s ease-out;
|
||||||
@@ -119,10 +119,10 @@ summary {
|
|||||||
|
|
||||||
#guns {
|
#guns {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 55px;
|
top: 40px;
|
||||||
left: 40px;
|
left: 15px;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
font-size: 25px;
|
font-size: 23px;
|
||||||
color: #111;
|
color: #111;
|
||||||
background-color: rgba(255, 255, 255, 0.4);
|
background-color: rgba(255, 255, 255, 0.4);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
@@ -134,12 +134,14 @@ summary {
|
|||||||
|
|
||||||
#mods {
|
#mods {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20px;
|
top: 15px;
|
||||||
right: 20px;
|
right: 15px;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
font-size: 21px;
|
font-size: 19px;
|
||||||
color: #111;
|
color: #000;
|
||||||
|
text-align: right;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
line-height: 140%;
|
||||||
background-color: rgba(255, 255, 255, 0.4);
|
background-color: rgba(255, 255, 255, 0.4);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user