working on giving custom mods requirements (in progress, buggy)
This commit is contained in:
235
js/bullets.js
235
js/bullets.js
@@ -42,65 +42,26 @@ const b = {
|
|||||||
modLaserFieldDrain: null,
|
modLaserFieldDrain: null,
|
||||||
isModNoAmmo: null,
|
isModNoAmmo: null,
|
||||||
isModAmmoFromHealth: null,
|
isModAmmoFromHealth: null,
|
||||||
mobDieAtHealth: null,
|
modMobDieAtHealth: null,
|
||||||
isModEnergyRecovery: null,
|
isModEnergyRecovery: null,
|
||||||
isModHealthRecovery: null,
|
isModHealthRecovery: null,
|
||||||
setModDefaults() {
|
isModEnergyLoss: null,
|
||||||
b.modCount = 0;
|
removeAllMods() {
|
||||||
b.modFireRate = 1;
|
for (let i = 0, len = b.mods.length; i < len; i++) {
|
||||||
b.modExplosionRadius = 1;
|
b.mods[i].remove();
|
||||||
b.isModImmuneExplosion = false;
|
|
||||||
b.modBulletSize = 1;
|
|
||||||
b.isModDroneOnDamage = false;
|
|
||||||
b.modEnergySiphon = 0;
|
|
||||||
b.modHealthDrain = 0;
|
|
||||||
b.modNoAmmo = 0;
|
|
||||||
b.isModBulletsLastLonger = 1;
|
|
||||||
b.isModDroneCollide = true;
|
|
||||||
b.isModFastSpores = false
|
|
||||||
b.isModImmortal = false;
|
|
||||||
b.modSpores = 0;
|
|
||||||
b.modAcidDmg = 0;
|
|
||||||
b.isModAcidDmg = false;
|
|
||||||
game.playerDmgColor = "rgba(0,0,0,0.7)"
|
|
||||||
b.isModAnnihilation = false;
|
|
||||||
b.modRecursiveHealing = 1;
|
|
||||||
b.modSquirrelFx = 1;
|
|
||||||
b.isModCrit = false;
|
|
||||||
b.isModBayesian = 0;
|
|
||||||
b.isModFourOptions = false;
|
|
||||||
b.isModLowHealthDmg = false;
|
|
||||||
b.isModFarAwayDmg = false;
|
|
||||||
b.isModEntanglement = false;
|
|
||||||
b.isModMassEnergy = false;
|
|
||||||
b.modLaserBotCount = 0;
|
|
||||||
b.modNailBotCount = 0;
|
|
||||||
b.modBlockDmg = 0;
|
|
||||||
b.isModPiezo = false;
|
|
||||||
b.isModStomp = false;
|
|
||||||
b.modCollisionImmuneCycles = 30;
|
|
||||||
b.modSuperBallNumber = 4;
|
|
||||||
b.modLaserReflections = 2;
|
|
||||||
b.modLaserDamage = 0.05;
|
|
||||||
b.modLaserFieldDrain = 0.002;
|
|
||||||
b.isModNoAmmo = false;
|
|
||||||
b.isModAmmoFromHealth = 0;
|
|
||||||
b.mobDieAtHealth = 0.05;
|
|
||||||
b.isModEnergyRecovery = false;
|
|
||||||
b.isModHealthRecovery = false;
|
|
||||||
mech.fieldRange = 175;
|
|
||||||
mech.Fx = 0.016; //if this changes update the values in definePlayerMass
|
|
||||||
mech.jumpForce = 0.42; //was 0.38 at 0.0019 gravity
|
|
||||||
mech.maxHealth = 1;
|
|
||||||
mech.fieldEnergyMax = 1;
|
|
||||||
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is flak
|
|
||||||
if (b.guns[i].name === "flak") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < b.mods.length; i++) {
|
|
||||||
b.mods[i].count = 0
|
b.mods[i].count = 0
|
||||||
}
|
}
|
||||||
|
b.modCount = 0;
|
||||||
|
|
||||||
},
|
},
|
||||||
modOnHealthChange() {
|
setModDefaults() {
|
||||||
|
for (let i = 0, len = b.mods.length; i < len; i++) {
|
||||||
|
if (b.mods[i].count) b.mods[i].remove();
|
||||||
|
b.mods[i].count = 0
|
||||||
|
}
|
||||||
|
b.modCount = 0;
|
||||||
|
},
|
||||||
|
modOnHealthChange() { //used with acid mod
|
||||||
if (b.isModAcidDmg && mech.health > 0.8) {
|
if (b.isModAcidDmg && mech.health > 0.8) {
|
||||||
game.playerDmgColor = "rgba(0,80,80,0.9)"
|
game.playerDmgColor = "rgba(0,80,80,0.9)"
|
||||||
b.modAcidDmg = 0.9
|
b.modAcidDmg = 0.9
|
||||||
@@ -119,6 +80,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.modBulletSize += 0.13
|
b.modBulletSize += 0.13
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modBulletSize = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -127,11 +91,16 @@ const b = {
|
|||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
return mech.health > 0.8
|
return mech.health > 0.8 || level.isBuildRun
|
||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModAcidDmg = true;
|
b.isModAcidDmg = true;
|
||||||
b.modOnHealthChange();
|
b.modOnHealthChange();
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modAcidDmg = 0;
|
||||||
|
b.isModAcidDmg = false;
|
||||||
|
game.playerDmgColor = "rgba(0,0,0,0.7)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -144,6 +113,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModCrit = true;
|
b.isModCrit = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModCrit = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -156,6 +128,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModFarAwayDmg = true; //used in mob.damage()
|
b.isModFarAwayDmg = true; //used in mob.damage()
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModFarAwayDmg = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -168,6 +143,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModLowHealthDmg = true; //used in mob.damage()
|
b.isModLowHealthDmg = true; //used in mob.damage()
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModLowHealthDmg = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -180,11 +158,14 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.modExplosionRadius += 0.2;
|
b.modExplosionRadius += 0.2;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modExplosionRadius = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "electric reactive armour",
|
name: "electric reactive armour",
|
||||||
description: "<strong class='color-e'>explosions</strong> do you no <strong>harm</strong>, but drain <strong class='color-f'>energy</strong>",
|
description: "<strong class='color-e'>explosions</strong> do no <strong>harm</strong><br> <strong class='color-e'>explosions</strong> drain <strong class='color-f'>energy</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -192,6 +173,10 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.isModImmuneExplosion = true;
|
b.isModImmuneExplosion = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModImmuneExplosion = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -204,6 +189,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.modFireRate *= 0.86
|
b.modFireRate *= 0.86
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modFireRate = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -216,6 +204,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.modNoAmmo = 1
|
b.modNoAmmo = 1
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modNoAmmo = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -228,6 +219,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModBulletsLastLonger += 0.33
|
b.isModBulletsLastLonger += 0.33
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModBulletsLastLonger = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -239,7 +233,10 @@ const b = {
|
|||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.mobDieAtHealth = 0.15
|
b.modMobDieAtHealth = 0.15
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modMobDieAtHealth = 0.05;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -255,6 +252,9 @@ const b = {
|
|||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
b.spore(player)
|
b.spore(player)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modSpores = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -268,6 +268,9 @@ const b = {
|
|||||||
effect() {
|
effect() {
|
||||||
b.modLaserBotCount++;
|
b.modLaserBotCount++;
|
||||||
b.laserBot();
|
b.laserBot();
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modLaserBotCount = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -281,6 +284,9 @@ const b = {
|
|||||||
effect() {
|
effect() {
|
||||||
b.modNailBotCount++;
|
b.modNailBotCount++;
|
||||||
b.nailBot();
|
b.nailBot();
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modNailBotCount = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -296,6 +302,9 @@ const b = {
|
|||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
b.drone() //spawn drone
|
b.drone() //spawn drone
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModDroneOnDamage = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -308,6 +317,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.modBlockDmg += 0.7 //if you change this value also update the for loop in the electricity graphics in mech.pushMass
|
b.modBlockDmg += 0.7 //if you change this value also update the for loop in the electricity graphics in mech.pushMass
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modBlockDmg = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -319,7 +331,10 @@ const b = {
|
|||||||
return mech.fieldUpgrades[mech.fieldMode].name !== "time dilation field" && mech.fieldUpgrades[mech.fieldMode].name !== "phase decoherence field"
|
return mech.fieldUpgrades[mech.fieldMode].name !== "time dilation field" && mech.fieldUpgrades[mech.fieldMode].name !== "phase decoherence field"
|
||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
mech.fieldRange = 175 * 1.4 //175 is default
|
mech.fieldRange = 175 * 1.4
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
mech.fieldRange = 175;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -332,10 +347,13 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModEntanglement = true
|
b.isModEntanglement = true
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModEntanglement = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "waste energy recycling",
|
name: "waste energy recovery",
|
||||||
description: "regen <strong>7%</strong> of max <strong class='color-f'>energy</strong> every second<br>active for <strong>5 seconds</strong> after a mob <strong>dies</strong>",
|
description: "regen <strong>7%</strong> of max <strong class='color-f'>energy</strong> every second<br>active for <strong>5 seconds</strong> after a mob <strong>dies</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
@@ -344,10 +362,13 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModEnergyRecovery = true;
|
b.isModEnergyRecovery = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModEnergyRecovery = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "waste scrap recycling",
|
name: "scrap recycling",
|
||||||
description: "regen up to <strong>1%</strong> of max <strong class='color-h'>health</strong> every second<br>active for <strong>5 seconds</strong> after a mob <strong>dies</strong>",
|
description: "regen up to <strong>1%</strong> of max <strong class='color-h'>health</strong> every second<br>active for <strong>5 seconds</strong> after a mob <strong>dies</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
@@ -356,6 +377,24 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModHealthRecovery = true;
|
b.isModHealthRecovery = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModHealthRecovery = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "acute stress response",
|
||||||
|
description: "increase <strong class='color-d'>damage</strong> by <strong>50%</strong><br>no <strong class='color-f'>energy</strong> for <strong>5 seconds</strong> after a mob <strong>dies</strong>",
|
||||||
|
maxCount: 1,
|
||||||
|
count: 0,
|
||||||
|
allowed() {
|
||||||
|
return b.isModHealthRecovery
|
||||||
|
},
|
||||||
|
effect() {
|
||||||
|
b.isModEnergyLoss = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModEnergyLoss = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -370,6 +409,11 @@ const b = {
|
|||||||
b.modSquirrelFx += 0.2;
|
b.modSquirrelFx += 0.2;
|
||||||
mech.Fx = 0.016 * b.modSquirrelFx;
|
mech.Fx = 0.016 * b.modSquirrelFx;
|
||||||
mech.jumpForce += 0.038;
|
mech.jumpForce += 0.038;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modSquirrelFx = 1;
|
||||||
|
mech.Fx = 0.016; //if this changes update the values in definePlayerMass
|
||||||
|
mech.jumpForce = 0.42; //was 0.38 at 0.0019 gravity
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -382,6 +426,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModStomp = true
|
b.isModStomp = true
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModStomp = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -395,6 +442,9 @@ const b = {
|
|||||||
effect() {
|
effect() {
|
||||||
b.modCollisionImmuneCycles += 120;
|
b.modCollisionImmuneCycles += 120;
|
||||||
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modCollisionImmuneCycles = 30;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -407,6 +457,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModAnnihilation = true
|
b.isModAnnihilation = true
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModAnnihilation = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -420,6 +473,9 @@ const b = {
|
|||||||
effect() {
|
effect() {
|
||||||
b.isModPiezo = true;
|
b.isModPiezo = true;
|
||||||
mech.fieldMeter = mech.fieldEnergyMax;
|
mech.fieldMeter = mech.fieldEnergyMax;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModPiezo = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -433,6 +489,9 @@ const b = {
|
|||||||
effect() {
|
effect() {
|
||||||
b.modEnergySiphon += 0.15;
|
b.modEnergySiphon += 0.15;
|
||||||
mech.fieldMeter = mech.fieldEnergyMax
|
mech.fieldMeter = mech.fieldEnergyMax
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modEnergySiphon = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -445,6 +504,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.modHealthDrain += 0.015;
|
b.modHealthDrain += 0.015;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modHealthDrain = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -458,6 +520,9 @@ const b = {
|
|||||||
effect() {
|
effect() {
|
||||||
mech.fieldEnergyMax += 0.5
|
mech.fieldEnergyMax += 0.5
|
||||||
mech.fieldMeter += 0.5
|
mech.fieldMeter += 0.5
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
mech.fieldEnergyMax = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -471,6 +536,9 @@ const b = {
|
|||||||
effect() {
|
effect() {
|
||||||
mech.maxHealth += 0.50
|
mech.maxHealth += 0.50
|
||||||
mech.addHealth(0.50)
|
mech.addHealth(0.50)
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
mech.maxHealth = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -483,6 +551,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.modRecursiveHealing += 1
|
b.modRecursiveHealing += 1
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modRecursiveHealing = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -496,6 +567,9 @@ const b = {
|
|||||||
effect: () => {
|
effect: () => {
|
||||||
b.isModMassEnergy = true // used in mech.grabPowerUp
|
b.isModMassEnergy = true // used in mech.grabPowerUp
|
||||||
mech.fieldMeter = mech.fieldEnergyMax * 2
|
mech.fieldMeter = mech.fieldEnergyMax * 2
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModMassEnergy = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -508,6 +582,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModImmortal = true;
|
b.isModImmortal = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModImmortal = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -520,6 +597,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.isModBayesian = 0.20;
|
b.isModBayesian = 0.20;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModBayesian = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -532,6 +612,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.isModAmmoFromHealth = 0.03;
|
b.isModAmmoFromHealth = 0.03;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModAmmoFromHealth = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -552,6 +635,9 @@ const b = {
|
|||||||
powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
|
powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
|
||||||
if (Math.random() < b.isModBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
|
if (Math.random() < b.isModBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModNoAmmo = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -564,6 +650,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.isModFourOptions = true;
|
b.isModFourOptions = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModFourOptions = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -582,6 +671,9 @@ const b = {
|
|||||||
}
|
}
|
||||||
b.setModDefaults(); // remove all mods
|
b.setModDefaults(); // remove all mods
|
||||||
//have state is checked in mech.death()
|
//have state is checked in mech.death()
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
//nothing to undo
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -594,6 +686,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModDroneCollide = true
|
b.isModDroneCollide = true
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModDroneCollide = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -606,6 +701,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.isModFastSpores = true
|
b.isModFastSpores = true
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModFastSpores = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -618,6 +716,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
b.modSuperBallNumber++
|
b.modSuperBallNumber++
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modSuperBallNumber = 4;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -632,6 +733,11 @@ const b = {
|
|||||||
b.modLaserReflections++;
|
b.modLaserReflections++;
|
||||||
b.modLaserDamage += 0.010; //base is 0.05
|
b.modLaserDamage += 0.010; //base is 0.05
|
||||||
b.modLaserFieldDrain += 0.0004 //base is 0.002
|
b.modLaserFieldDrain += 0.0004 //base is 0.002
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modLaserReflections = 2;
|
||||||
|
b.modLaserDamage = 0.05;
|
||||||
|
b.modLaserFieldDrain = 0.002;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -646,6 +752,11 @@ const b = {
|
|||||||
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is flak
|
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is flak
|
||||||
if (b.guns[i].name === "flak") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack * (2 + this.count);
|
if (b.guns[i].name === "flak") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack * (2 + this.count);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is flak
|
||||||
|
if (b.guns[i].name === "flak") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
@@ -1551,7 +1662,7 @@ const b = {
|
|||||||
name: "fléchettes", //3
|
name: "fléchettes", //3
|
||||||
description: "fire a volley of <strong>precise</strong> high velocity needles",
|
description: "fire a volley of <strong>precise</strong> high velocity needles",
|
||||||
ammo: 0,
|
ammo: 0,
|
||||||
ammoPack: 20,
|
ammoPack: 22,
|
||||||
have: false,
|
have: false,
|
||||||
isStarterGun: true,
|
isStarterGun: true,
|
||||||
count: 0, //used to track how many shots are in a volley before a big CD
|
count: 0, //used to track how many shots are in a volley before a big CD
|
||||||
@@ -1572,7 +1683,7 @@ const b = {
|
|||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle), 45 * b.modBulletSize, 1.4 * b.modBulletSize, b.fireAttributes(mech.angle));
|
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle), 45 * b.modBulletSize, 1.4 * b.modBulletSize, b.fireAttributes(mech.angle));
|
||||||
bullet[me].endCycle = game.cycle + 180;
|
bullet[me].endCycle = game.cycle + 180;
|
||||||
bullet[me].dmg = 1.1;
|
bullet[me].dmg = 1.15;
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function () {
|
||||||
if (this.speed < 10) this.force.y += this.mass * 0.0003; //no gravity until it slows don to improve aiming
|
if (this.speed < 10) this.force.y += this.mass * 0.0003; //no gravity until it slows don to improve aiming
|
||||||
};
|
};
|
||||||
|
|||||||
16
js/game.js
16
js/game.js
@@ -436,12 +436,12 @@ const game = {
|
|||||||
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;
|
b.activeGun = null;
|
||||||
b.setModDefaults(); //remove mods
|
|
||||||
|
b.removeAllMods(); //sets mods to defauls values
|
||||||
game.updateModHUD();
|
game.updateModHUD();
|
||||||
mech.maxHealth = 1
|
mech.maxHealth = 1
|
||||||
mech.fieldEnergyMax = 1
|
mech.fieldEnergyMax = 1
|
||||||
game.paused = false;
|
game.paused = false;
|
||||||
build.isShowingBuilds = false
|
|
||||||
engine.timing.timeScale = 1;
|
engine.timing.timeScale = 1;
|
||||||
game.fpsCap = game.fpsCapDefault;
|
game.fpsCap = game.fpsCapDefault;
|
||||||
game.makeGunHUD();
|
game.makeGunHUD();
|
||||||
@@ -460,6 +460,7 @@ const game = {
|
|||||||
game.CDScale = 1;
|
game.CDScale = 1;
|
||||||
game.difficulty = 0;
|
game.difficulty = 0;
|
||||||
game.difficultyMode = Number(document.getElementById("difficulty-select").value)
|
game.difficultyMode = Number(document.getElementById("difficulty-select").value)
|
||||||
|
level.isBuildRun = false;
|
||||||
if (game.difficultyMode === 0) {
|
if (game.difficultyMode === 0) {
|
||||||
game.isEasyMode = true;
|
game.isEasyMode = true;
|
||||||
game.difficultyMode = 1
|
game.difficultyMode = 1
|
||||||
@@ -490,7 +491,6 @@ const game = {
|
|||||||
document.getElementById("build-grid").style.display = "none"
|
document.getElementById("build-grid").style.display = "none"
|
||||||
document.getElementById("pause-grid-left").style.display = "none"
|
document.getElementById("pause-grid-left").style.display = "none"
|
||||||
document.getElementById("pause-grid-right").style.display = "none"
|
document.getElementById("pause-grid-right").style.display = "none"
|
||||||
isShowingBuilds = false
|
|
||||||
document.getElementById("splash").style.display = "inline";
|
document.getElementById("splash").style.display = "inline";
|
||||||
document.getElementById("dmg").style.display = "none";
|
document.getElementById("dmg").style.display = "none";
|
||||||
document.getElementById("health-bg").style.display = "none";
|
document.getElementById("health-bg").style.display = "none";
|
||||||
@@ -499,9 +499,11 @@ const game = {
|
|||||||
fpsInterval: 0, //set in startGame
|
fpsInterval: 0, //set in startGame
|
||||||
then: null,
|
then: null,
|
||||||
startGame() {
|
startGame() {
|
||||||
level.isBuildRun = false; //can get set back to true in build.startBuildRun()
|
if (!level.isBuildRun) { //if a build run logic flow returns to "build-button").addEventListener
|
||||||
game.onTitlePage = false;
|
document.body.style.cursor = "none";
|
||||||
document.body.style.overflow = "hidden"
|
document.body.style.overflow = "hidden"
|
||||||
|
}
|
||||||
|
game.onTitlePage = false;
|
||||||
document.getElementById("choose-grid").style.display = "none"
|
document.getElementById("choose-grid").style.display = "none"
|
||||||
document.getElementById("build-grid").style.display = "none"
|
document.getElementById("build-grid").style.display = "none"
|
||||||
document.getElementById("info").style.display = "none";
|
document.getElementById("info").style.display = "none";
|
||||||
@@ -529,7 +531,6 @@ const game = {
|
|||||||
// // mech.throwBlock();
|
// // mech.throwBlock();
|
||||||
// };
|
// };
|
||||||
|
|
||||||
document.body.style.cursor = "none";
|
|
||||||
if (game.firstRun) {
|
if (game.firstRun) {
|
||||||
mech.spawn(); //spawns the player
|
mech.spawn(); //spawns the player
|
||||||
b.setModDefaults(); //doesn't run on reset so that gun mods carry over to new runs
|
b.setModDefaults(); //doesn't run on reset so that gun mods carry over to new runs
|
||||||
@@ -674,6 +675,9 @@ const game = {
|
|||||||
if (b.isModHealthRecovery) {
|
if (b.isModHealthRecovery) {
|
||||||
mech.addHealth(0.01)
|
mech.addHealth(0.01)
|
||||||
}
|
}
|
||||||
|
if (b.isModEnergyLoss) {
|
||||||
|
mech.fieldMeter = 0.05;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
101
js/index.js
101
js/index.js
@@ -14,9 +14,13 @@ const cat = {
|
|||||||
|
|
||||||
//build build grid display
|
//build build grid display
|
||||||
const build = {
|
const build = {
|
||||||
isShowingBuilds: false,
|
|
||||||
list: [],
|
|
||||||
choosePowerUp(who, index, type) {
|
choosePowerUp(who, index, type) {
|
||||||
|
|
||||||
|
// mech.setField(build.list[i].index)
|
||||||
|
// b.giveGuns(build.list[i].index)
|
||||||
|
// b.giveMod(build.list[i].index)
|
||||||
|
|
||||||
|
|
||||||
if (type === "field" || type === "gun") {
|
if (type === "field" || type === "gun") {
|
||||||
let isDeselect = false
|
let isDeselect = false
|
||||||
//if already click, toggle off
|
//if already click, toggle off
|
||||||
@@ -30,6 +34,7 @@ const build = {
|
|||||||
}
|
}
|
||||||
//check if trying to get a second field
|
//check if trying to get a second field
|
||||||
if (type === "field") {
|
if (type === "field") {
|
||||||
|
mech.setField(index)
|
||||||
for (let i = 0; i < build.list.length; i++) {
|
for (let i = 0; i < build.list.length; i++) {
|
||||||
if (build.list[i].type === "field") { //if already click, toggle off
|
if (build.list[i].type === "field") { //if already click, toggle off
|
||||||
build.list[i].who.style.backgroundColor = "#fff"
|
build.list[i].who.style.backgroundColor = "#fff"
|
||||||
@@ -79,9 +84,9 @@ const build = {
|
|||||||
// document.title = `effective starting level: ${build.list.length * game.difficultyMode}`
|
// document.title = `effective starting level: ${build.list.length * game.difficultyMode}`
|
||||||
// build.calculateCustomDifficulty()
|
// build.calculateCustomDifficulty()
|
||||||
},
|
},
|
||||||
makeGrid() {
|
populateGrid() {
|
||||||
let text = `
|
let text = `
|
||||||
<div style="display: flex; justify-content: space-around; align-items: center;">
|
<div style="display: flex; justify-content: space-around; align-items: center;">
|
||||||
<svg class="SVG-button" onclick="build.startBuildRun()" width="115" height="51">
|
<svg class="SVG-button" onclick="build.startBuildRun()" width="115" height="51">
|
||||||
<g stroke='none' fill='#333' stroke-width="2" font-size="40px" font-family="Ariel, sans-serif">
|
<g stroke='none' fill='#333' stroke-width="2" font-size="40px" font-family="Ariel, sans-serif">
|
||||||
<text x="18" y="38">start</text>
|
<text x="18" y="38">start</text>
|
||||||
@@ -110,16 +115,21 @@ const build = {
|
|||||||
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'gun')"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[i].name}</div> ${b.guns[i].description}</div>`
|
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'gun')"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[i].name}</div> ${b.guns[i].description}</div>`
|
||||||
}
|
}
|
||||||
for (let i = 0, len = b.mods.length; i < len; i++) {
|
for (let i = 0, len = b.mods.length; i < len; i++) {
|
||||||
if (b.mods[i].name === "Born rule" || b.mods[i].name === "+1 cardinality" || b.mods[i].name === "leveraged investment") {
|
if (
|
||||||
|
!b.mods[i].allowed() ||
|
||||||
|
b.mods[i].name === "+1 cardinality" || b.mods[i].name === "leveraged investment"
|
||||||
|
) {
|
||||||
text += `<div class="build-grid-module" style="opacity:0.3;"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
|
text += `<div class="build-grid-module" style="opacity:0.3;"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
|
||||||
} else {
|
} else {
|
||||||
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
|
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const el = document.getElementById("build-grid")
|
document.getElementById("build-grid").innerHTML = text
|
||||||
el.innerHTML = text
|
},
|
||||||
el.style.display = "none"
|
reset() {
|
||||||
|
build.populateGrid();
|
||||||
|
|
||||||
|
document.getElementById("difficulty-select-custom").value = localSettings.difficultyMode
|
||||||
document.getElementById("difficulty-select-custom").addEventListener("input", () => {
|
document.getElementById("difficulty-select-custom").addEventListener("input", () => {
|
||||||
document.getElementById("difficulty-select").value = document.getElementById("difficulty-select-custom").value
|
document.getElementById("difficulty-select").value = document.getElementById("difficulty-select-custom").value
|
||||||
game.difficultyMode = Number(document.getElementById("difficulty-select-custom").value)
|
game.difficultyMode = Number(document.getElementById("difficulty-select-custom").value)
|
||||||
@@ -127,14 +137,24 @@ const build = {
|
|||||||
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||||
// build.calculateCustomDifficulty()
|
// build.calculateCustomDifficulty()
|
||||||
});
|
});
|
||||||
},
|
|
||||||
reset() {
|
|
||||||
build.list = []
|
|
||||||
build.makeGrid();
|
|
||||||
document.getElementById("build-grid").style.display = "grid"
|
document.getElementById("build-grid").style.display = "grid"
|
||||||
// build.calculateCustomDifficulty()
|
// build.calculateCustomDifficulty()
|
||||||
document.getElementById("difficulty-select-custom").value = localSettings.difficultyMode
|
document.getElementById("difficulty-select-custom").value = localSettings.difficultyMode
|
||||||
},
|
},
|
||||||
|
|
||||||
|
startBuildRun() {
|
||||||
|
spawn.setSpawnList(); //gives random mobs, not starter mobs
|
||||||
|
spawn.setSpawnList();
|
||||||
|
const increase = Number(document.getElementById("starting-level").value) * game.difficultyMode
|
||||||
|
level.levelsCleared += increase;
|
||||||
|
level.difficultyIncrease(increase) //increase difficulty based on modes
|
||||||
|
document.body.style.cursor = "none";
|
||||||
|
document.body.style.overflow = "hidden"
|
||||||
|
document.getElementById("build-grid").style.display = "none"
|
||||||
|
game.paused = false;
|
||||||
|
requestAnimationFrame(cycle);
|
||||||
|
},
|
||||||
pauseGrid() {
|
pauseGrid() {
|
||||||
// let text = `<div class="pause-grid-module" style="border:0px;background:none;"></div>`
|
// let text = `<div class="pause-grid-module" style="border:0px;background:none;"></div>`
|
||||||
let text = `
|
let text = `
|
||||||
@@ -161,7 +181,11 @@ const build = {
|
|||||||
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[mech.fieldMode].name}</div> ${mech.fieldUpgrades[mech.fieldMode].description}</div>`
|
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[mech.fieldMode].name}</div> ${mech.fieldUpgrades[mech.fieldMode].description}</div>`
|
||||||
for (let i = 0, len = b.mods.length; i < len; i++) {
|
for (let i = 0, len = b.mods.length; i < len; i++) {
|
||||||
if (b.mods[i].count > 0) {
|
if (b.mods[i].count > 0) {
|
||||||
|
if (b.mods[i].count === 1) {
|
||||||
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
|
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
|
||||||
|
} else {
|
||||||
|
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[i].name} (${b.mods[i].count}x)</div> ${b.mods[i].description}</div>`
|
||||||
|
}
|
||||||
countMods++
|
countMods++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -178,59 +202,20 @@ const build = {
|
|||||||
document.getElementById("pause-grid-left").style.display = "none"
|
document.getElementById("pause-grid-left").style.display = "none"
|
||||||
document.getElementById("pause-grid-right").style.display = "none"
|
document.getElementById("pause-grid-right").style.display = "none"
|
||||||
},
|
},
|
||||||
// calculateCustomDifficulty() {
|
|
||||||
// let difficulty = build.list.length * game.difficultyMode
|
|
||||||
// if (game.difficultyMode === 0) difficulty = build.list.length * 1 - 6
|
|
||||||
// if (game.difficultyMode === 4) difficulty = build.list.length * 4 + 8
|
|
||||||
// document.getElementById("starting-level").innerHTML = `starting difficulty: <strong style="font-size:1.05em;">${difficulty}</strong>`
|
|
||||||
// },
|
|
||||||
startBuildRun() {
|
|
||||||
spawn.setSpawnList(); //gives random mobs, not starter mobs
|
|
||||||
spawn.setSpawnList();
|
|
||||||
game.startGame();
|
|
||||||
|
|
||||||
level.isBuildRun = true;
|
|
||||||
const increase = Number(document.getElementById("starting-level").value) * game.difficultyMode
|
|
||||||
level.levelsCleared += increase;
|
|
||||||
level.difficultyIncrease(increase) //increase difficulty based on modes
|
|
||||||
|
|
||||||
level.onLevel = 1;
|
|
||||||
build.givePowerUps();
|
|
||||||
},
|
|
||||||
givePowerUps() {
|
|
||||||
for (let i = 0; i < build.list.length; i++) {
|
|
||||||
if (build.list[i].type === "field") {
|
|
||||||
mech.setField(build.list[i].index)
|
|
||||||
} else if (build.list[i].type === "gun") {
|
|
||||||
b.giveGuns(build.list[i].index)
|
|
||||||
} else if (build.list[i].type === "mod") {
|
|
||||||
b.giveMod(build.list[i].index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build.makeGrid();
|
document.getElementById("build-button").addEventListener("click", () => { //setup build run
|
||||||
|
|
||||||
document.getElementById("build-button").addEventListener("click", () => {
|
|
||||||
document.getElementById("build-button").style.display = "none";
|
document.getElementById("build-button").style.display = "none";
|
||||||
const el = document.getElementById("build-grid")
|
const el = document.getElementById("build-grid")
|
||||||
if (build.isShowingBuilds) {
|
|
||||||
el.style.display = "none"
|
|
||||||
build.isShowingBuilds = false
|
|
||||||
document.body.style.overflow = "hidden"
|
|
||||||
document.getElementById("info").style.display = 'inline'
|
|
||||||
} else {
|
|
||||||
build.list = []
|
|
||||||
build.reset()
|
|
||||||
// let text = '<p>The difficulty increases by one level for each power up you choose.<br> <button type="button" id="build-begin-button" onclick="build.startBuildRun()">Begin Run</button></p>'
|
|
||||||
build.isShowingBuilds = true
|
|
||||||
el.style.display = "grid"
|
el.style.display = "grid"
|
||||||
document.body.style.overflowY = "scroll";
|
document.body.style.overflowY = "scroll";
|
||||||
document.body.style.overflowX = "hidden";
|
document.body.style.overflowX = "hidden";
|
||||||
document.getElementById("info").style.display = 'none'
|
document.getElementById("info").style.display = 'none'
|
||||||
}
|
|
||||||
// build.calculateCustomDifficulty()
|
level.isBuildRun = true;
|
||||||
|
game.startGame(); //starts game, but pauses it
|
||||||
|
game.paused = true;
|
||||||
|
build.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -243,7 +228,6 @@ if (localSettings) {
|
|||||||
|
|
||||||
game.difficultyMode = localSettings.difficultyMode
|
game.difficultyMode = localSettings.difficultyMode
|
||||||
document.getElementById("difficulty-select").value = localSettings.difficultyMode
|
document.getElementById("difficulty-select").value = localSettings.difficultyMode
|
||||||
document.getElementById("difficulty-select-custom").value = localSettings.difficultyMode
|
|
||||||
|
|
||||||
if (localSettings.fpsCapDefault === 'max') {
|
if (localSettings.fpsCapDefault === 'max') {
|
||||||
game.fpsCapDefault = 999999999;
|
game.fpsCapDefault = 999999999;
|
||||||
@@ -358,7 +342,6 @@ document.getElementById("body-damage").addEventListener("input", () => {
|
|||||||
|
|
||||||
// difficulty-select-custom event listener is set in build.makeGrid
|
// difficulty-select-custom event listener is set in build.makeGrid
|
||||||
document.getElementById("difficulty-select").addEventListener("input", () => {
|
document.getElementById("difficulty-select").addEventListener("input", () => {
|
||||||
document.getElementById("difficulty-select-custom").value = document.getElementById("difficulty-select").value
|
|
||||||
game.difficultyMode = Number(document.getElementById("difficulty-select").value)
|
game.difficultyMode = Number(document.getElementById("difficulty-select").value)
|
||||||
localSettings.difficultyMode = game.difficultyMode
|
localSettings.difficultyMode = game.difficultyMode
|
||||||
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ const level = {
|
|||||||
// b.giveGuns("laser")
|
// b.giveGuns("laser")
|
||||||
// mech.setField("negative mass field")
|
// mech.setField("negative mass field")
|
||||||
// for (let i = 0; i < 9; i++) {
|
// for (let i = 0; i < 9; i++) {
|
||||||
// b.giveMod("waste energy recycling");
|
// b.giveMod("waste energy recovery");
|
||||||
// b.giveMod("field superposition");
|
// b.giveMod("scrap recycling");
|
||||||
|
// b.giveMod("acute stress response");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
level.intro(); //starting level
|
level.intro(); //starting level
|
||||||
@@ -37,7 +38,6 @@ const level = {
|
|||||||
level[level.levels[level.onLevel]](); //picks the current map from the the levels array
|
level[level.levels[level.onLevel]](); //picks the current map from the the levels array
|
||||||
level.levelAnnounce();
|
level.levelAnnounce();
|
||||||
}
|
}
|
||||||
// if (level.isBuildRun) build.givePowerUps();
|
|
||||||
game.noCameraScroll();
|
game.noCameraScroll();
|
||||||
game.setZoom();
|
game.setZoom();
|
||||||
level.addToWorld(); //add bodies to game engine
|
level.addToWorld(); //add bodies to game engine
|
||||||
@@ -1261,7 +1261,7 @@ const level = {
|
|||||||
level.defaultZoom = 1300
|
level.defaultZoom = 1300
|
||||||
game.zoomTransition(level.defaultZoom)
|
game.zoomTransition(level.defaultZoom)
|
||||||
|
|
||||||
document.body.style.backgroundColor = "#f2f5f3";
|
document.body.style.backgroundColor = "#dcdcde" //"#f2f5f3";
|
||||||
mech.setPosToSpawn(25, -60); //normal spawn
|
mech.setPosToSpawn(25, -60); //normal spawn
|
||||||
//mech.setPosToSpawn(-2000, -1700); // left ledge spawn
|
//mech.setPosToSpawn(-2000, -1700); // left ledge spawn
|
||||||
level.enter.x = mech.spawnPos.x - 50;
|
level.enter.x = mech.spawnPos.x - 50;
|
||||||
|
|||||||
@@ -940,13 +940,14 @@ const mobs = {
|
|||||||
if (b.isModLowHealthDmg) dmg *= (3 / (2 + mech.health)) //up to 50% dmg at zero player health
|
if (b.isModLowHealthDmg) dmg *= (3 / (2 + mech.health)) //up to 50% dmg at zero player health
|
||||||
|
|
||||||
// if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(1000, Math.min(3500, this.distanceToPlayer())) - 1000) * 0.01 //up to 50% dmg at max range of 3500
|
// if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(1000, Math.min(3500, this.distanceToPlayer())) - 1000) * 0.01 //up to 50% dmg at max range of 3500
|
||||||
|
if (b.isModEnergyLoss) dmg *= 1.5;
|
||||||
if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(500, Math.min(3000, this.distanceToPlayer())) - 500) * 0.0067 //up to 50% dmg at max range of 3500
|
if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(500, Math.min(3000, this.distanceToPlayer())) - 500) * 0.0067 //up to 50% dmg at max range of 3500
|
||||||
if (b.modEnergySiphon && dmg !== Infinity) mech.fieldMeter += Math.min(this.health, dmg) * b.modEnergySiphon
|
if (b.modEnergySiphon && dmg !== Infinity) mech.fieldMeter += Math.min(this.health, dmg) * b.modEnergySiphon
|
||||||
if (b.modHealthDrain && dmg !== Infinity) mech.addHealth(Math.min(this.health, dmg) * b.modHealthDrain)
|
if (b.modHealthDrain && dmg !== Infinity) mech.addHealth(Math.min(this.health, dmg) * b.modHealthDrain)
|
||||||
this.health -= dmg
|
this.health -= dmg
|
||||||
//this.fill = this.color + this.health + ')';
|
//this.fill = this.color + this.health + ')';
|
||||||
this.onDamage(dmg); //custom damage effects
|
this.onDamage(dmg); //custom damage effects
|
||||||
if (this.health < b.mobDieAtHealth && this.alive) this.death();
|
if (this.health < b.modMobDieAtHealth && this.alive) this.death();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDamage() {
|
onDamage() {
|
||||||
|
|||||||
22
js/player.js
22
js/player.js
@@ -67,7 +67,7 @@ const mech = {
|
|||||||
defaultMass: 5,
|
defaultMass: 5,
|
||||||
mass: 5,
|
mass: 5,
|
||||||
FxNotHolding: 0.015,
|
FxNotHolding: 0.015,
|
||||||
Fx: null, //run Force on ground //0.015 //this is set in b.setModDefaults()
|
Fx: 0.015, //run Force on ground //
|
||||||
FxAir: 0.016, //run Force in Air
|
FxAir: 0.016, //run Force in Air
|
||||||
yOff: 70,
|
yOff: 70,
|
||||||
yOffGoal: 70,
|
yOffGoal: 70,
|
||||||
@@ -105,7 +105,7 @@ const mech = {
|
|||||||
Sy: 0, //adds a smoothing effect to vertical only
|
Sy: 0, //adds a smoothing effect to vertical only
|
||||||
Vx: 0,
|
Vx: 0,
|
||||||
Vy: 0,
|
Vy: 0,
|
||||||
jumpForce: null, //0.38 //this is reset in b.setModDefaults()
|
jumpForce: 0.38, //0.38 //this is reset in b.setModDefaults()
|
||||||
gravity: 0.0024, //0.0019 //game.g is 0.001
|
gravity: 0.0024, //0.0019 //game.g is 0.001
|
||||||
friction: {
|
friction: {
|
||||||
ground: 0.01,
|
ground: 0.01,
|
||||||
@@ -653,7 +653,7 @@ const mech = {
|
|||||||
throwChargeRate: 0,
|
throwChargeRate: 0,
|
||||||
throwChargeMax: 0,
|
throwChargeMax: 0,
|
||||||
fieldShieldingScale: 0,
|
fieldShieldingScale: 0,
|
||||||
fieldRange: 0,
|
fieldRange: 175,
|
||||||
fieldArc: 0,
|
fieldArc: 0,
|
||||||
fieldThreshold: 0,
|
fieldThreshold: 0,
|
||||||
calculateFieldThreshold() {
|
calculateFieldThreshold() {
|
||||||
@@ -1375,11 +1375,11 @@ const mech = {
|
|||||||
mech.lookForPickUp();
|
mech.lookForPickUp();
|
||||||
mech.pushMobs360();
|
mech.pushMobs360();
|
||||||
//look for nearby objects to make zero-g
|
//look for nearby objects to make zero-g
|
||||||
function zeroG(who, mag = 1.06) {
|
function zeroG(who, range, mag = 1.06) {
|
||||||
for (let i = 0, len = who.length; i < len; ++i) {
|
for (let i = 0, len = who.length; i < len; ++i) {
|
||||||
sub = Vector.sub(who[i].position, mech.pos);
|
sub = Vector.sub(who[i].position, mech.pos);
|
||||||
dist = Vector.magnitude(sub);
|
dist = Vector.magnitude(sub);
|
||||||
if (dist < mech.fieldRange) {
|
if (dist < range) {
|
||||||
who[i].force.y -= who[i].mass * (game.g * mag); //add a bit more then standard gravity
|
who[i].force.y -= who[i].mass * (game.g * mag); //add a bit more then standard gravity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1390,20 +1390,20 @@ const mech = {
|
|||||||
if (keys[83] || keys[40]) { //down
|
if (keys[83] || keys[40]) { //down
|
||||||
player.force.y -= 0.5 * player.mass * mech.gravity;
|
player.force.y -= 0.5 * player.mass * mech.gravity;
|
||||||
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 400 * 0.03;
|
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 400 * 0.03;
|
||||||
zeroG(powerUp, 0.7);
|
zeroG(powerUp, this.fieldDrawRadius, 0.7);
|
||||||
zeroG(body, 0.7);
|
zeroG(body, this.fieldDrawRadius, 0.7);
|
||||||
} else if (keys[87] || keys[38]) { //up
|
} else if (keys[87] || keys[38]) { //up
|
||||||
mech.fieldMeter -= 5 * DRAIN;
|
mech.fieldMeter -= 5 * DRAIN;
|
||||||
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 850 * 0.03;
|
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 850 * 0.03;
|
||||||
player.force.y -= 1.45 * player.mass * mech.gravity;
|
player.force.y -= 1.45 * player.mass * mech.gravity;
|
||||||
zeroG(powerUp, 1.38);
|
zeroG(powerUp, this.fieldDrawRadius, 1.38);
|
||||||
zeroG(body, 1.38);
|
zeroG(body, this.fieldDrawRadius, 1.38);
|
||||||
} else {
|
} else {
|
||||||
mech.fieldMeter -= DRAIN;
|
mech.fieldMeter -= DRAIN;
|
||||||
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 650 * 0.03;
|
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 650 * 0.03;
|
||||||
player.force.y -= 1.07 * player.mass * mech.gravity; // slow upward drift
|
player.force.y -= 1.07 * player.mass * mech.gravity; // slow upward drift
|
||||||
zeroG(powerUp);
|
zeroG(powerUp, this.fieldDrawRadius);
|
||||||
zeroG(body);
|
zeroG(body, this.fieldDrawRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
//add extra friction for horizontal motion
|
//add extra friction for horizontal motion
|
||||||
|
|||||||
21
todo.txt
21
todo.txt
@@ -1,4 +1,17 @@
|
|||||||
mod - nano scale field makes spores instead of drones
|
************** TODO - n-gon **************
|
||||||
|
|
||||||
|
add in requirements to custom mode
|
||||||
|
grey out mods that don't meet requirements
|
||||||
|
make custom undo method for mods
|
||||||
|
this makes toggleing mods on and off easier in custom
|
||||||
|
|
||||||
|
mod - acute stress response
|
||||||
|
permanently increase damage by 30%
|
||||||
|
for 5 seconds after a mob dies
|
||||||
|
drain energy down to zero
|
||||||
|
|
||||||
|
|
||||||
|
mod - nano-scale field makes spores instead of drones
|
||||||
|
|
||||||
mod - mines - fire something instead of needles on activation
|
mod - mines - fire something instead of needles on activation
|
||||||
foam?, flak?, vacuum bomb, super balls
|
foam?, flak?, vacuum bomb, super balls
|
||||||
@@ -36,8 +49,6 @@ mod: shotgun - fire extra shot
|
|||||||
|
|
||||||
mob: targeting laser, then a high speed, no gravity bullet
|
mob: targeting laser, then a high speed, no gravity bullet
|
||||||
|
|
||||||
add recursive mod counts to pause screen
|
|
||||||
|
|
||||||
css transition for pause menu
|
css transition for pause menu
|
||||||
|
|
||||||
field that pushes everything back, and can destroy smaller blocks
|
field that pushes everything back, and can destroy smaller blocks
|
||||||
@@ -109,10 +120,6 @@ new map with repeating endlessness
|
|||||||
I tried it, but had trouble getting the camera to adjust to the teleportation
|
I tried it, but had trouble getting the camera to adjust to the teleportation
|
||||||
this can apply to blocks mobs, and power ups as well
|
this can apply to blocks mobs, and power ups as well
|
||||||
|
|
||||||
field power up effects
|
|
||||||
field allows player to hold and throw living mobs
|
|
||||||
and hack mobs
|
|
||||||
|
|
||||||
give mobs more animal-like behaviors
|
give mobs more animal-like behaviors
|
||||||
like rain world
|
like rain world
|
||||||
give mobs something to do when they don't see player
|
give mobs something to do when they don't see player
|
||||||
|
|||||||
Reference in New Issue
Block a user