shields are
shields are more rare, but much stronger, negative mass field is combined with Gauss rifle mod, negative mass field moves player faster, new mod piezoelectric plating,You may now choose to cancel the power up selection screen. (no recursive mods in custon yet, it's an annoying UI rewrite)
This commit is contained in:
1115
js/bullets.js
1115
js/bullets.js
File diff suppressed because it is too large
Load Diff
47
js/engine.js
47
js/engine.js
@@ -79,7 +79,7 @@ function mobCollisionChecks(event) {
|
||||
for (let i = 0, j = pairs.length; i != j; i++) {
|
||||
|
||||
//body + player collision
|
||||
if (game.isBodyDamage && mech.damageImmune < mech.cycle) {
|
||||
if (game.isBodyDamage) {
|
||||
if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) {
|
||||
collidePlayer(pairs[i].bodyB)
|
||||
} else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) {
|
||||
@@ -91,7 +91,6 @@ function mobCollisionChecks(event) {
|
||||
if (obj.classType === "body" && obj.speed > speedThreshold && obj.mass > massThreshold) { //dmg from hitting a body
|
||||
const v = Vector.magnitude(Vector.sub(player.velocity, obj.velocity));
|
||||
if (v > speedThreshold) {
|
||||
mech.damageImmune = mech.cycle + 30; //player is immune to collision damage for 30 cycles
|
||||
let dmg = Math.sqrt((v - speedThreshold + 0.1) * (obj.mass - massThreshold)) * 0.01;
|
||||
dmg = Math.min(Math.max(dmg, 0.02), 0.15);
|
||||
mech.damage(dmg);
|
||||
@@ -105,21 +104,6 @@ function mobCollisionChecks(event) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// else if (obj.isStatic && player.speed > speedThreshold * 2) { //falling dmg / hitting map dmg
|
||||
// mech.damageImmune = mech.cycle + 30;
|
||||
// console.log(player.speed)
|
||||
// let dmg = Math.min(Math.max(player.speed * 0.001, 0.02), 0.2);
|
||||
// mech.damage(dmg);
|
||||
// game.drawList.push({
|
||||
// //add dmg to draw queue
|
||||
// x: pairs[i].activeContacts[0].vertex.x,
|
||||
// y: pairs[i].activeContacts[0].vertex.y,
|
||||
// radius: dmg * 500,
|
||||
// color: game.mobDmgColor,
|
||||
// time: game.drawTime
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
//mob + (player,bullet,body) collisions
|
||||
@@ -135,9 +119,9 @@ function mobCollisionChecks(event) {
|
||||
|
||||
function collideMob(obj) {
|
||||
//player + mob collision
|
||||
if (obj === playerBody || obj === playerHead) {
|
||||
if (mech.damageImmune < mech.cycle) {
|
||||
mech.damageImmune = mech.cycle + 30; //player is immune to collision damage for 30 cycles
|
||||
if (mech.collisionImmune < mech.cycle) {
|
||||
if (obj === playerBody || obj === playerHead) {
|
||||
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||
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
|
||||
mech.damage(dmg);
|
||||
@@ -163,23 +147,24 @@ function mobCollisionChecks(event) {
|
||||
});
|
||||
|
||||
}
|
||||
//extra kick between player and mob //this section would be better with forces but they don't work...
|
||||
let angle = Math.atan2(player.position.y - mob[k].position.y, player.position.x - mob[k].position.x);
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: player.velocity.x + 8 * Math.cos(angle),
|
||||
y: player.velocity.y + 8 * Math.sin(angle)
|
||||
});
|
||||
Matter.Body.setVelocity(mob[k], {
|
||||
x: mob[k].velocity.x - 8 * Math.cos(angle),
|
||||
y: mob[k].velocity.y - 8 * Math.sin(angle)
|
||||
});
|
||||
return;
|
||||
}
|
||||
//extra kick between player and mob //this section would be better with forces but they don't work...
|
||||
let angle = Math.atan2(player.position.y - mob[k].position.y, player.position.x - mob[k].position.x);
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: player.velocity.x + 8 * Math.cos(angle),
|
||||
y: player.velocity.y + 8 * Math.sin(angle)
|
||||
});
|
||||
Matter.Body.setVelocity(mob[k], {
|
||||
x: mob[k].velocity.x - 8 * Math.cos(angle),
|
||||
y: mob[k].velocity.y - 8 * Math.sin(angle)
|
||||
});
|
||||
return;
|
||||
}
|
||||
//mob + bullet collisions
|
||||
if (obj.classType === "bullet" && obj.speed > obj.minDmgSpeed) {
|
||||
// const dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)));
|
||||
let dmg = b.dmgScale * (obj.dmg + b.modExtraDmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
|
||||
if (mob[k].shield) dmg *= 0.3
|
||||
if (b.isModCrit && !mob[k].seePlayer.recall) dmg *= 5
|
||||
mob[k].foundPlayer();
|
||||
mob[k].damage(dmg);
|
||||
|
||||
57
js/index.js
57
js/index.js
@@ -2,11 +2,25 @@
|
||||
/* TODO: *******************************************
|
||||
*****************************************************
|
||||
|
||||
mod: fields do damage on blocking
|
||||
name: something about radiation?
|
||||
|
||||
mod: do something at the end of each level
|
||||
heal to full
|
||||
should still be effected by the heal reduction at higher difficulty
|
||||
give ammo to current gun
|
||||
give goals/quests for each level
|
||||
how to track goals?
|
||||
take no damage
|
||||
don't shoot
|
||||
|
||||
selection options for field to stay with current
|
||||
|
||||
custom mode grey out mods that are bad, like selection based mods
|
||||
not important
|
||||
|
||||
custom mode can't use recursive mods
|
||||
|
||||
field graphics too dark at high energy
|
||||
not important
|
||||
|
||||
@@ -19,9 +33,10 @@ game setting for slower computers
|
||||
fewer debris
|
||||
fewer mobs
|
||||
|
||||
mod: guardian
|
||||
recursive
|
||||
spawns at start of level
|
||||
mod: gain energy after taking damage
|
||||
use piezoelectric name (already used)
|
||||
|
||||
mod: ground stomp on enterLand()
|
||||
|
||||
mod: if you fire when out of ammo you gain 1 ammo pack at the cost of
|
||||
10% max health
|
||||
@@ -153,6 +168,7 @@ const build = {
|
||||
list: [],
|
||||
choosePowerUp(who, index, type) {
|
||||
//check if matching a current power up
|
||||
// if (type === "field" || type === "gun") {
|
||||
for (let i = 0; i < build.list.length; i++) {
|
||||
if (build.list[i].index === index && build.list[i].type === type) { //if already click, toggle off
|
||||
build.list.splice(i, 1);
|
||||
@@ -160,7 +176,6 @@ const build = {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//check if trying to get a second field
|
||||
if (type === "field") {
|
||||
for (let i = 0; i < build.list.length; i++) {
|
||||
@@ -170,15 +185,47 @@ const build = {
|
||||
}
|
||||
}
|
||||
}
|
||||
// } else { //type is mod
|
||||
|
||||
// //count each mod type to check for recursion caps
|
||||
// let counts = []
|
||||
// for (let i = 0; i < build.list.length; i++) {
|
||||
// if (build.list[i].type === "mod") {
|
||||
// if (!counts[build.list[i].index]) {
|
||||
// counts[build.list[i].index] = 1
|
||||
// } else {
|
||||
// counts[build.list[i].index] = counts[build.list[i].index] + 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (let i = 0; i < build.list.length; i++) {
|
||||
// //if above max count, toggle off
|
||||
// if (build.list[i].index === index && build.list[i].type === type &&
|
||||
// counts[index] >= b.mods[index].maxCount) {
|
||||
// //remove all versions of mod
|
||||
|
||||
|
||||
// who.style.backgroundColor = "#fff"
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (build.list.length < 5) { //add to build array
|
||||
who.style.backgroundColor = "#919ba8" //"#868f9a"
|
||||
build.list[build.list.length] = {
|
||||
who: who,
|
||||
index: index,
|
||||
type: type
|
||||
type: type,
|
||||
}
|
||||
}
|
||||
console.log(build.list)
|
||||
},
|
||||
removeMod(index) {
|
||||
for (let i = build.list.length - 1; i > -1; i--) {
|
||||
if (build.list[i].type === "mod" && build.list[i].index === index) build.list.splice(i, 1);
|
||||
}
|
||||
},
|
||||
startBuildRun() {
|
||||
spawn.setSpawnList();
|
||||
|
||||
@@ -14,9 +14,9 @@ const level = {
|
||||
start() {
|
||||
if (level.levelsCleared === 0) {
|
||||
// game.difficulty = 6; //for testing to simulate possible mobs spawns
|
||||
// b.giveGuns(0)
|
||||
// mech.setField(2)
|
||||
// b.giveMod(20)
|
||||
// b.giveGuns(15)
|
||||
// mech.setField(3)
|
||||
// b.giveMod(10);
|
||||
|
||||
level.intro(); //starting level
|
||||
// level.testingMap();
|
||||
@@ -114,7 +114,7 @@ const level = {
|
||||
// spawn.lineBoss(-500, -600, spawn.allowedBossList[Math.floor(Math.random() * spawn.allowedBossList.length)]);
|
||||
// spawn.bodyRect(-135, -50, 50, 50);
|
||||
// spawn.bodyRect(-140, -100, 50, 50);
|
||||
powerUps.spawn(420, -400, "field", false);
|
||||
powerUps.spawn(420, -400, "gun", false);
|
||||
// powerUps.spawn(420, -400, "field", false);
|
||||
// powerUps.spawn(420, -400, "field", false);
|
||||
// powerUps.spawn(420, -400, "field", false);
|
||||
|
||||
@@ -961,7 +961,7 @@ const mobs = {
|
||||
if (this.dropPowerUp) {
|
||||
powerUps.spawnRandomPowerUp(this.position.x, this.position.y, this.mass, radius);
|
||||
if (Math.random() < b.modSpores) {
|
||||
for (let i = 0, len = Math.floor(3 + this.mass * Math.random()); i < len; i++) {
|
||||
for (let i = 0, len = Math.floor(4 + this.mass * Math.random()); i < len; i++) {
|
||||
b.spore(this) //spawn drone
|
||||
}
|
||||
}
|
||||
|
||||
52
js/player.js
52
js/player.js
@@ -55,7 +55,7 @@ const mech = {
|
||||
cycle: 0,
|
||||
width: 50,
|
||||
radius: 30,
|
||||
fillColor: "#fff",
|
||||
fillColor: "#fff", //changed by mod piezoelectric plating (damage immunity)
|
||||
fillColorDark: "#ccc",
|
||||
height: 42,
|
||||
yOffWhen: {
|
||||
@@ -207,7 +207,6 @@ const mech = {
|
||||
mech.hardLandCD = mech.cycle + Math.min(momentum / 6 - 6, 40)
|
||||
|
||||
if (game.isBodyDamage && player.velocity.y > 26 && momentum > 165 * b.modSquirrelFx) { //falling damage
|
||||
mech.damageImmune = mech.cycle + 30; //player is immune to collision damage for 30 cycles
|
||||
let dmg = Math.sqrt(momentum - 165) * 0.01
|
||||
dmg = Math.min(Math.max(dmg, 0.02), 0.20);
|
||||
mech.damage(dmg);
|
||||
@@ -440,6 +439,7 @@ const mech = {
|
||||
mech.displayHealth();
|
||||
},
|
||||
defaultFPSCycle: 0, //tracks when to return to normal fps
|
||||
collisionImmune: 0, //used in engine
|
||||
damage(dmg) {
|
||||
if (b.isModEntanglement && b.inventory[0] === b.activeGun) {
|
||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||
@@ -513,7 +513,6 @@ const mech = {
|
||||
// };
|
||||
// requestAnimationFrame(normalFPS);
|
||||
},
|
||||
damageImmune: 0,
|
||||
hitMob(i, dmg) {
|
||||
//prevents damage happening too quick
|
||||
},
|
||||
@@ -588,11 +587,13 @@ const mech = {
|
||||
mech.knee.y = (l / d) * (mech.foot.y - mech.hip.y) + (h / d) * (mech.foot.x - mech.hip.x) + mech.hip.y;
|
||||
},
|
||||
draw() {
|
||||
// mech.fillColor = (mech.collisionImmune < mech.cycle) ? "#fff" : "rgba(255,255,255,0.1)" //"#cff"
|
||||
ctx.fillStyle = mech.fillColor;
|
||||
mech.walk_cycle += mech.flipLegs * mech.Vx;
|
||||
|
||||
//draw body
|
||||
ctx.save();
|
||||
ctx.globalAlpha = (mech.collisionImmune < mech.cycle) ? 1 : 0.7
|
||||
ctx.translate(mech.pos.x, mech.pos.y);
|
||||
mech.calcLeg(Math.PI, -3);
|
||||
mech.drawLeg("#4a4a4a");
|
||||
@@ -654,8 +655,10 @@ const mech = {
|
||||
mech.fieldCDcycle = 0;
|
||||
mech.isStealth = false;
|
||||
player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield
|
||||
mech.holdingMassScale = 0.5;
|
||||
mech.fieldShieldingScale = 1; //scale energy loss after collision with mob
|
||||
mech.holdingMassScale = 0.5;
|
||||
mech.throwChargeRate = 2;
|
||||
mech.throwChargeMax = 50;
|
||||
mech.grabRange = 175;
|
||||
mech.fieldArc = 0.2; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
||||
mech.calculateFieldThreshold(); //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
||||
@@ -1311,9 +1314,12 @@ const mech = {
|
||||
},
|
||||
{
|
||||
name: "negative mass field",
|
||||
description: "use <strong class='color-f'>energy</strong> to nullify <strong style='letter-spacing: 10px;'>gravity</strong><br><em>can fire bullets while active</em>",
|
||||
description: "use <strong class='color-f'>energy</strong> to nullify <strong style='letter-spacing: 12px;'>gravity</strong><br><strong>launch</strong> larger blocks at much higher speeds",
|
||||
effect: () => {
|
||||
mech.fieldFire = true;
|
||||
mech.throwChargeRate = 4;
|
||||
mech.throwChargeMax = 150;
|
||||
mech.holdingMassScale = 0.05; //can hold heavier blocks with lower cost to jumping
|
||||
|
||||
mech.hold = function () {
|
||||
if (mech.isHolding) {
|
||||
@@ -1321,11 +1327,11 @@ const mech = {
|
||||
mech.holding();
|
||||
mech.throwBlock();
|
||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
|
||||
const DRAIN = 0.0004
|
||||
const DRAIN = 0.00025
|
||||
if (mech.fieldMeter > DRAIN) {
|
||||
mech.grabPowerUp();
|
||||
mech.lookForPickUp(170);
|
||||
mech.pushMobs360(200);
|
||||
mech.lookForPickUp(150);
|
||||
mech.pushMobs360(150);
|
||||
//look for nearby objects to make zero-g
|
||||
function zeroG(who, mag = 1.06) {
|
||||
for (let i = 0, len = who.length; i < len; ++i) {
|
||||
@@ -1339,22 +1345,17 @@ const mech = {
|
||||
// zeroG(bullet); //works fine, but not that noticeable and maybe not worth the possible performance hit
|
||||
// zeroG(mob); //mobs are too irregular to make this work?
|
||||
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: player.velocity.x,
|
||||
y: player.velocity.y * 0.97
|
||||
});
|
||||
|
||||
if (keys[83] || keys[40]) { //down
|
||||
player.force.y -= 0.8 * player.mass * mech.gravity;
|
||||
player.force.y -= 0.5 * player.mass * mech.gravity;
|
||||
mech.grabRange = mech.grabRange * 0.97 + 400 * 0.03;
|
||||
zeroG(powerUp, 0.85);
|
||||
zeroG(body, 0.85);
|
||||
zeroG(powerUp, 0.7);
|
||||
zeroG(body, 0.7);
|
||||
} else if (keys[87] || keys[38]) { //up
|
||||
mech.fieldMeter -= 5 * DRAIN;
|
||||
mech.grabRange = mech.grabRange * 0.97 + 750 * 0.03;
|
||||
player.force.y -= 1.2 * player.mass * mech.gravity;
|
||||
zeroG(powerUp, 1.13);
|
||||
zeroG(body, 1.13);
|
||||
mech.grabRange = mech.grabRange * 0.97 + 850 * 0.03;
|
||||
player.force.y -= 1.45 * player.mass * mech.gravity;
|
||||
zeroG(powerUp, 1.38);
|
||||
zeroG(body, 1.38);
|
||||
} else {
|
||||
mech.fieldMeter -= DRAIN;
|
||||
mech.grabRange = mech.grabRange * 0.97 + 650 * 0.03;
|
||||
@@ -1366,8 +1367,13 @@ const mech = {
|
||||
//add extra friction for horizontal motion
|
||||
if (keys[65] || keys[68] || keys[37] || keys[39]) {
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: player.velocity.x * 0.85,
|
||||
y: player.velocity.y
|
||||
x: player.velocity.x * 0.95,
|
||||
y: player.velocity.y * 0.97
|
||||
});
|
||||
} else { //slow rise and fall
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: player.velocity.x,
|
||||
y: player.velocity.y * 0.97
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1443,7 +1449,7 @@ const mech = {
|
||||
mech.hold = function () {
|
||||
if (mech.fieldMeter > mech.fieldEnergyMax - 0.02 && mech.fieldCDcycle < mech.cycle) {
|
||||
mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
|
||||
mech.fieldMeter -= 0.32;
|
||||
mech.fieldMeter -= 0.35;
|
||||
b.drone(1)
|
||||
}
|
||||
if (mech.isHolding) {
|
||||
|
||||
@@ -22,6 +22,14 @@ const powerUps = {
|
||||
game.isChoosing = false; //stops p from un pausing on key down
|
||||
requestAnimationFrame(cycle);
|
||||
},
|
||||
cancel() {
|
||||
document.body.style.cursor = "none";
|
||||
document.getElementById("choose-grid").style.display = "none"
|
||||
document.getElementById("choose-background").style.display = "none"
|
||||
game.paused = false;
|
||||
game.isChoosing = false; //stops p from un pausing on key down
|
||||
requestAnimationFrame(cycle);
|
||||
},
|
||||
showDraft() {
|
||||
document.getElementById("choose-grid").style.display = "grid"
|
||||
document.getElementById("choose-background").style.display = "inline"
|
||||
@@ -36,11 +44,10 @@ const powerUps = {
|
||||
return 40 * Math.sqrt(0.1 + Math.random() * 0.5);
|
||||
},
|
||||
effect() {
|
||||
let heal = ((this.size / 40) ** 2)
|
||||
heal = Math.min(mech.maxHealth - mech.health, heal)
|
||||
if (b.isModRecursiveHealing) heal *= 2
|
||||
let heal = 0
|
||||
for (let i = 0; i < b.modRecursiveHealing; i++) heal += ((this.size / 40) ** 2)
|
||||
if (heal > 0) game.makeTextLog("<div class='circle heal'></div> <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (Math.min(mech.maxHealth - mech.health, heal) * game.healScale * 100).toFixed(0) + "%</span>", 300)
|
||||
mech.addHealth(heal);
|
||||
if (heal > 0) game.makeTextLog("<div class='circle heal'></div> <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (heal * game.healScale * 100).toFixed(0) + "%</span>", 300)
|
||||
}
|
||||
},
|
||||
ammo: {
|
||||
@@ -72,8 +79,7 @@ const powerUps = {
|
||||
mech.fieldMeter = mech.fieldEnergyMax;
|
||||
if (!game.lastLogTime) game.makeTextLog("<span style='font-size:115%;'><span class='color-f'>+energy</span></span>", 300);
|
||||
} else {
|
||||
//ammo given scales as mobs take more hits to kill
|
||||
let ammo = Math.ceil((target.ammoPack * (0.4 + 0.05 * Math.random())));
|
||||
let ammo = Math.ceil((target.ammoPack * (1 + 0.05 * Math.random())));
|
||||
if (level.isBuildRun) ammo = Math.floor(ammo * 1.1) //extra ammo on build run because no ammo from getting a new gun
|
||||
target.ammo += ammo;
|
||||
game.updateGunHUD();
|
||||
@@ -100,7 +106,7 @@ const powerUps = {
|
||||
let choice2 = doNotHave(mech.fieldUpgrades, choice1)
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
let text = `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a field</h3>`
|
||||
let text = `<div class='cancel' onclick='powerUps.cancel()'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a field</h3>`
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice1].name}</div> ${mech.fieldUpgrades[choice1].description}</div>`
|
||||
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice2})"><div class="grid-title"><div class="circle-grid field"></div> ${mech.fieldUpgrades[choice2].name}</div> ${mech.fieldUpgrades[choice2].description}</div>`
|
||||
if (!b.isModBayesian) {
|
||||
@@ -138,7 +144,7 @@ const powerUps = {
|
||||
let choice2 = doNotHave(b.mods, choice1)
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
let text = "<h3 style = 'color:#fff; text-align:center; margin: 0px;'>choose a mod</h3>"
|
||||
let text = "<div class='cancel' onclick='powerUps.cancel()'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a mod</h3>"
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice1})"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[choice1].name}</div> ${b.mods[choice1].description}</div>`
|
||||
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice2})"><div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[choice2].name}</div> ${b.mods[choice2].description}</div>`
|
||||
if (!b.isModBayesian) {
|
||||
@@ -175,7 +181,7 @@ const powerUps = {
|
||||
let choice2 = doNotHave(b.guns, choice1)
|
||||
let choice3 = -1
|
||||
if (choice1 > -1) {
|
||||
let text = "<h3 style = 'color:#fff; text-align:center; margin: 0px;'>choose a gun</h3>"
|
||||
let text = "<div class='cancel' onclick='powerUps.cancel()'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a gun</h3>"
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice1})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice1].name}</div> ${b.guns[choice1].description}</div>`
|
||||
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice2})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice2].name}</div> ${b.guns[choice2].description}</div>`
|
||||
if (!b.isModBayesian) {
|
||||
@@ -195,7 +201,7 @@ const powerUps = {
|
||||
},
|
||||
giveRandomAmmo() {
|
||||
const ammoTarget = Math.floor(Math.random() * (b.guns.length));
|
||||
const ammo = Math.ceil(b.guns[ammoTarget].ammoPack * 2);
|
||||
const ammo = Math.ceil(b.guns[ammoTarget].ammoPack * 6);
|
||||
b.guns[ammoTarget].ammo += ammo;
|
||||
game.updateGunHUD();
|
||||
game.makeTextLog("<span style='font-size:110%;'>+" + ammo + " ammo for " + b.guns[ammoTarget].name + "</span>", 300);
|
||||
@@ -206,17 +212,17 @@ const powerUps = {
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "heal");
|
||||
return;
|
||||
}
|
||||
if (Math.random() < 0.2 && b.inventory.length > 0) {
|
||||
if (Math.random() < 0.15 && b.inventory.length > 0) {
|
||||
powerUps.spawn(x, y, "ammo");
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "ammo");
|
||||
return;
|
||||
}
|
||||
if (Math.random() < 0.004 * (4 - b.inventory.length)) { //a new gun has a low chance for each not acquired gun up to 4
|
||||
if (Math.random() < 0.0035 * (3 - b.inventory.length)) { //a new gun has a low chance for each not acquired gun up to 4
|
||||
powerUps.spawn(x, y, "gun");
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "gun");
|
||||
return;
|
||||
}
|
||||
if (Math.random() < 0.0035 * (9 - b.modCount)) { //a new mod has a low chance for each not acquired mod up to 7
|
||||
if (Math.random() < 0.0031 * (10 - b.modCount)) { //a new mod has a low chance for each not acquired mod up to 7
|
||||
powerUps.spawn(x, y, "mod");
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "mod");
|
||||
return;
|
||||
@@ -231,28 +237,28 @@ const powerUps = {
|
||||
if (mech.fieldMode === 0) {
|
||||
powerUps.spawn(x, y, "field")
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "field")
|
||||
} else if (Math.random() < 0.55) {
|
||||
} else if (Math.random() < 0.6) {
|
||||
powerUps.spawn(x, y, "mod")
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "mod")
|
||||
} else if (Math.random() < 0.2) {
|
||||
} else if (Math.random() < 0.1) {
|
||||
powerUps.spawn(x, y, "gun")
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "gun")
|
||||
} else if (Math.random() < 0.1) {
|
||||
powerUps.spawn(x, y, "field");
|
||||
if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "field");
|
||||
} else if (mech.health < 0.65) {
|
||||
powerUps.spawn(x, y, "heal");
|
||||
powerUps.spawn(x, y, "heal");
|
||||
powerUps.spawn(x, y, "heal");
|
||||
if (Math.random() < b.isModBayesian) {
|
||||
powerUps.spawn(x, y, "heal");
|
||||
powerUps.spawn(x, y, "heal");
|
||||
}
|
||||
} else {
|
||||
powerUps.spawn(x, y, "ammo");
|
||||
powerUps.spawn(x, y, "ammo");
|
||||
powerUps.spawn(x, y, "ammo");
|
||||
if (Math.random() < b.isModBayesian) {
|
||||
powerUps.spawn(x, y, "ammo");
|
||||
powerUps.spawn(x, y, "ammo");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
14
js/spawn.js
14
js/spawn.js
@@ -233,7 +233,7 @@ const spawn = {
|
||||
me.accelMag = 0.001 * game.accelScale;;
|
||||
me.g = me.accelMag * 0.6; //required if using 'gravity'
|
||||
me.memory = 50;
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.07, 0.5)) spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.05, 0.3)) spawn.shield(me, x, y);
|
||||
me.do = function () {
|
||||
this.gravity();
|
||||
this.seePlayerCheck();
|
||||
@@ -293,7 +293,7 @@ const spawn = {
|
||||
me.onDeath = function () {
|
||||
this.removeCons();
|
||||
};
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.07, 0.5)) spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.05, 0.3)) spawn.shield(me, x, y);
|
||||
me.do = function () {
|
||||
this.gravity();
|
||||
this.searchSpring();
|
||||
@@ -600,7 +600,7 @@ const spawn = {
|
||||
me.accelMag = 0.0005 * game.accelScale;
|
||||
me.frictionStatic = 0;
|
||||
me.friction = 0;
|
||||
if (Math.random() < Math.min(0.2 + (game.difficulty - 1) * 0.07, 0.5)) spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min(0.2 + (game.difficulty - 1) * 0.05, 0.3)) spawn.shield(me, x, y);
|
||||
me.do = function () {
|
||||
this.seePlayerByLookingAt();
|
||||
this.attraction();
|
||||
@@ -900,7 +900,7 @@ const spawn = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
if (Math.random() < Math.min(0.15 + (game.difficulty - 1) * 0.07, 0.5)) spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min(0.15 + (game.difficulty - 1) * 0.05, 0.3)) spawn.shield(me, x, y);
|
||||
me.do = function () {
|
||||
this.seePlayerByLookingAt();
|
||||
this.fire();
|
||||
@@ -970,7 +970,7 @@ const spawn = {
|
||||
});
|
||||
}
|
||||
};
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.05, 0.4)) spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.04, 0.2)) spawn.shield(me, x, y);
|
||||
me.do = function () {
|
||||
this.gravity();
|
||||
this.seePlayerCheck();
|
||||
@@ -1019,7 +1019,7 @@ const spawn = {
|
||||
me.laserRange = 500;
|
||||
Matter.Body.setDensity(me, 0.001 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.07, 0.5)) spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.05, 0.3)) spawn.shield(me, x, y);
|
||||
me.onDeath = function () {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
};
|
||||
@@ -1060,7 +1060,7 @@ const spawn = {
|
||||
me.memory = 20;
|
||||
Matter.Body.setDensity(me, 0.001 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.07, 0.5)) spawn.shield(me, x, y);
|
||||
if (Math.random() < Math.min((game.difficulty - 1) * 0.05, 0.3)) spawn.shield(me, x, y);
|
||||
|
||||
me.onDeath = function () {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
|
||||
Reference in New Issue
Block a user