swarn gun
This commit is contained in:
228
js/bullets.js
228
js/bullets.js
@@ -53,9 +53,9 @@ const b = {
|
||||
isModDeathAvoidOnCD: null,
|
||||
modWaveSpeedMap: null,
|
||||
modWaveSpeedBody: null,
|
||||
modFieldEfficiency: null,
|
||||
isModSporeField: null,
|
||||
isModMissileField: null,
|
||||
isModSwarmField: null,
|
||||
isModFlechetteMultiShot: null,
|
||||
isModMineAmmoBack: null,
|
||||
isModPlasmaRange: null,
|
||||
@@ -66,6 +66,8 @@ const b = {
|
||||
modThrowChargeRate: null,
|
||||
isModBlockStun: null,
|
||||
isModStunField: null,
|
||||
isModHarmDamage: null,
|
||||
isModAlphaRadiation: null,
|
||||
modOnHealthChange() { //used with acid mod
|
||||
if (b.isModAcidDmg && mech.health > 0.8) {
|
||||
game.playerDmgColor = "rgba(0,80,80,0.9)"
|
||||
@@ -91,25 +93,6 @@ const b = {
|
||||
b.modBulletSize = 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "fluoroantimonic acid",
|
||||
description: "each <strong>bullet</strong> does instant <strong class='color-p'>acid</strong> <strong class='color-d'>damage</strong><br><strong>active</strong> when you are above <strong>80%</strong> base health",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.health > 0.8 || build.isCustomSelection
|
||||
},
|
||||
requires: "health above 80%",
|
||||
effect() {
|
||||
b.isModAcidDmg = true;
|
||||
b.modOnHealthChange();
|
||||
},
|
||||
remove() {
|
||||
b.modAcidDmg = 0;
|
||||
b.isModAcidDmg = false;
|
||||
game.playerDmgColor = "rgba(0,0,0,0.7)"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "kinetic bombardment",
|
||||
description: "do up to <strong>33%</strong> more <strong class='color-d'>damage</strong> at a distance<br><em>increase maxes out at about 40 steps away</em>",
|
||||
@@ -143,7 +126,26 @@ const b = {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "quasistatic equilibrium",
|
||||
name: "fluoroantimonic acid",
|
||||
description: "each <strong>bullet</strong> does instant <strong class='color-p'>acid</strong> <strong class='color-d'>damage</strong><br><strong>active</strong> when you are above <strong>80%</strong> base health",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.health > 0.8 || build.isCustomSelection
|
||||
},
|
||||
requires: "health above 80%",
|
||||
effect() {
|
||||
b.isModAcidDmg = true;
|
||||
b.modOnHealthChange();
|
||||
},
|
||||
remove() {
|
||||
b.modAcidDmg = 0;
|
||||
b.isModAcidDmg = false;
|
||||
game.playerDmgColor = "rgba(0,0,0,0.7)"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "negative feedback",
|
||||
description: "do extra <strong class='color-d'>damage</strong> at low health<br><em>up to <strong>50%</strong> increase when near death</em>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
@@ -158,6 +160,22 @@ const b = {
|
||||
b.isModLowHealthDmg = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "radiative equilibrium",
|
||||
description: "after receiving any <strong>harm</strong><br>do <strong>2x</strong> <strong class='color-d'>damage</strong> for <strong>5 seconds</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return b.isModLowHealthDmg
|
||||
},
|
||||
requires: "quasistatic equilibrium",
|
||||
effect() {
|
||||
b.isModHarmDamage = true;
|
||||
},
|
||||
remove() {
|
||||
b.isModHarmDamage = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "high explosives",
|
||||
description: "<strong class='color-e'>explosions</strong> do <strong>+20%</strong> more <strong class='color-d'>damage</strong><br><strong class='color-e'>explosive</strong> area is <strong>+44% larger</strong>",
|
||||
@@ -313,9 +331,9 @@ const b = {
|
||||
maxCount: 3,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" || b.haveGunCheck("spores") || b.haveGunCheck("drones") || b.haveGunCheck("super balls") || b.haveGunCheck("foam") || b.haveGunCheck("wave beam")
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" || b.haveGunCheck("spores") || b.haveGunCheck("drones") || b.haveGunCheck("super balls") || b.haveGunCheck("foam") || b.haveGunCheck("wave beam") || b.haveGunCheck("swarm")
|
||||
},
|
||||
requires: "drones, spores, super balls,<br> foam, or wave beam",
|
||||
requires: "drones, spores, super balls,<br> foam, wave beam, or swarm",
|
||||
effect() {
|
||||
b.isModBulletsLastLonger += 0.33
|
||||
},
|
||||
@@ -1004,7 +1022,7 @@ const b = {
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return b.haveGunCheck("drones") || (mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModSporeField || b.isModMissileField))
|
||||
return b.haveGunCheck("drones") || (mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModSporeField || b.isModMissileField || b.isModSwarmField))
|
||||
},
|
||||
requires: "drones",
|
||||
effect() {
|
||||
@@ -1014,6 +1032,22 @@ const b = {
|
||||
b.isModDroneCollide = true;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "alpha radiation",
|
||||
description: "the <strong>swarm</strong> bots deliver a dose of<br><strong class='color-p'>radioactive</strong> <strong class='color-d'>damage</strong> over 3 seconds",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return b.haveGunCheck("swarm") || (mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && b.isModSwarmField)
|
||||
},
|
||||
requires: "swarm",
|
||||
effect() {
|
||||
b.isModAlphaRadiation = true
|
||||
},
|
||||
remove() {
|
||||
b.isModAlphaRadiation = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "foam stabilization",
|
||||
description: "<strong>foam</strong> can stick to shields",
|
||||
@@ -1057,18 +1091,18 @@ const b = {
|
||||
requires: "laser",
|
||||
effect() {
|
||||
b.modLaserReflections++;
|
||||
b.modLaserDamage += 0.025; //base is 0.05
|
||||
b.modLaserDamage += 0.035; //base is 0.06
|
||||
b.modLaserFieldDrain += 0.001 //base is 0.002
|
||||
},
|
||||
remove() {
|
||||
b.modLaserReflections = 2;
|
||||
b.modLaserDamage = 0.06;
|
||||
b.modLaserDamage = 0.07;
|
||||
b.modLaserFieldDrain = 0.002;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "flux pinning",
|
||||
description: "blocking <strong>stuns</strong> mobs for <strong>+1</strong> second<br>with the <strong>perfect diamagnetism</strong> field",
|
||||
description: "blocking with <strong>perfect diamagnetism</strong><br><strong>stuns</strong> mobs for <strong>+1</strong> second",
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1082,22 +1116,6 @@ const b = {
|
||||
b.isModStunField = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "bremsstrahlung radiation",
|
||||
description: "<strong>blocking</strong> with your field does <strong class='color-d'>damage</strong>",
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "standing wave harmonics" || mech.fieldUpgrades[mech.fieldMode].name === "perfect diamagnetism"
|
||||
},
|
||||
requires: "standing wave harmonics<br>or perfect diamagnetism",
|
||||
effect() {
|
||||
b.modBlockDmg += 0.4 //if you change this value also update the for loop in the electricity graphics in mech.pushMass
|
||||
},
|
||||
remove() {
|
||||
b.modBlockDmg = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "plasma jet",
|
||||
description: "increase <strong>plasma torch's</strong> range by <strong>33%</strong>",
|
||||
@@ -1130,6 +1148,22 @@ const b = {
|
||||
b.isModHawking = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "bremsstrahlung radiation",
|
||||
description: "<strong>blocking</strong> with your field does <strong class='color-d'>damage</strong>",
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "standing wave harmonics"
|
||||
},
|
||||
requires: "standing wave harmonics",
|
||||
effect() {
|
||||
b.modBlockDmg += 0.5 //if you change this value also update the for loop in the electricity graphics in mech.pushMass
|
||||
},
|
||||
remove() {
|
||||
b.modBlockDmg = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "frequency resonance",
|
||||
description: "<strong>standing wave harmonics</strong> shield is retuned<br>increase <strong>size</strong> and <strong>blocking</strong> efficiency by <strong>30%</strong>",
|
||||
@@ -1154,7 +1188,7 @@ const b = {
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !b.isModMissileField
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModMissileField || b.isModSwarmField)
|
||||
},
|
||||
requires: "nano-scale manufacturing",
|
||||
effect() {
|
||||
@@ -1170,7 +1204,7 @@ const b = {
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !b.isModSporeField
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModSporeField || b.isModSwarmField)
|
||||
},
|
||||
requires: "nano-scale manufacturing",
|
||||
effect() {
|
||||
@@ -1180,6 +1214,22 @@ const b = {
|
||||
b.isModMissileField = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "swarm manufacturing",
|
||||
description: "<strong>nano-scale manufacturing</strong> is repurposed<br>excess <strong class='color-f'>energy</strong> used to construct <strong>swarm</strong> bots",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(b.isModSporeField || b.isModMissileField)
|
||||
},
|
||||
requires: "nano-scale manufacturing",
|
||||
effect() {
|
||||
b.isModSwarmField = true;
|
||||
},
|
||||
remove() {
|
||||
b.isModSwarmField = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "quantum dissipation",
|
||||
description: "<strong>phase decoherence field</strong> uses <strong class='color-f'>energy</strong> to <br><strong class='color-d'>damage</strong> unshielded <strong>mobs</strong> that you <strong>overlap</strong>",
|
||||
@@ -1803,6 +1853,75 @@ const b = {
|
||||
});
|
||||
World.add(engine.world, bullet[bIndex]); //add bullet to world
|
||||
},
|
||||
swarm(speed = 0, spread = 2 * Math.PI) {
|
||||
const me = bullet.length;
|
||||
const THRUST = 0.004
|
||||
const dir = mech.angle + spread * (Math.random() - 0.5);
|
||||
const RADIUS = 17 * b.modBulletSize
|
||||
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 3, RADIUS, {
|
||||
angle: dir - Math.PI,
|
||||
inertia: Infinity,
|
||||
friction: 0,
|
||||
frictionAir: 0.10,
|
||||
restitution: 0.2,
|
||||
dmg: 0.3, //damage done in addition to the damage from momentum
|
||||
lookFrequency: 10 + Math.floor(7 * Math.random()),
|
||||
endCycle: game.cycle + 90 * b.isModBulletsLastLonger, //Math.floor((1200 + 420 * Math.random()) * b.isModBulletsLastLonger),
|
||||
classType: "bullet",
|
||||
collisionFilter: {
|
||||
category: cat.bullet,
|
||||
mask: cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield //self collide
|
||||
},
|
||||
minDmgSpeed: 0,
|
||||
lockedOn: null,
|
||||
isFollowMouse: true,
|
||||
onDmg(who) {
|
||||
this.endCycle = game.cycle
|
||||
if (b.isModAlphaRadiation) mobs.statusPoison(who, 0.08, 180)
|
||||
},
|
||||
onEnd() {},
|
||||
do() {
|
||||
// this.force.y += this.mass * 0.0002;
|
||||
//find mob targets
|
||||
if (!(game.cycle % this.lookFrequency)) {
|
||||
const scale = 0.9;
|
||||
Matter.Body.scale(this, scale, scale);
|
||||
this.lockedOn = null;
|
||||
let closeDist = Infinity;
|
||||
for (let i = 0, len = mob.length; i < len; ++i) {
|
||||
if (
|
||||
mob[i].dropPowerUp &&
|
||||
Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
|
||||
Matter.Query.ray(body, this.position, mob[i].position).length === 0
|
||||
) {
|
||||
const TARGET_VECTOR = Vector.sub(this.position, mob[i].position)
|
||||
const DIST = Vector.magnitude(TARGET_VECTOR);
|
||||
if (DIST < closeDist) {
|
||||
closeDist = DIST;
|
||||
this.lockedOn = mob[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.lockedOn) { //accelerate towards mobs
|
||||
this.force = Vector.mult(Vector.normalise(Vector.sub(this.position, this.lockedOn.position)), -this.mass * THRUST)
|
||||
} else {
|
||||
this.force = Vector.mult(Vector.normalise(this.velocity), this.mass * THRUST)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
World.add(engine.world, bullet[me]); //add bullet to world
|
||||
// Matter.Body.setAngularVelocity(bullet[me], 2 * (0.5 - Math.random())) //doesn't work due to high friction
|
||||
Matter.Body.setVelocity(bullet[me], {
|
||||
x: speed * Math.cos(dir),
|
||||
y: speed * Math.sin(dir)
|
||||
});
|
||||
// Matter.Body.setVelocity(bullet[me], {
|
||||
// x: mech.Vx / 2 + speed * Math.cos(dir),
|
||||
// y: mech.Vy / 2 + speed * Math.sin(dir)
|
||||
// });
|
||||
},
|
||||
drone(speed = 1) {
|
||||
const me = bullet.length;
|
||||
const THRUST = 0.0015
|
||||
@@ -2704,6 +2823,25 @@ const b = {
|
||||
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 5) * b.modFireRate); // cool down
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "swarm", //11
|
||||
description: "rapidly deploy <strong>short-lived</strong> bots<br>that <strong>seek</strong> out nearby mobs",
|
||||
ammo: 0,
|
||||
ammoPack: 80,
|
||||
have: false,
|
||||
isStarterGun: true,
|
||||
isEasyToAim: true,
|
||||
fire() {
|
||||
if (mech.crouch) {
|
||||
b.swarm(20, 0.3)
|
||||
mech.fireCDcycle = mech.cycle + Math.floor(10 * b.modFireRate); // cool down
|
||||
} else {
|
||||
b.swarm(2)
|
||||
mech.fireCDcycle = mech.cycle + Math.floor(3 * b.modFireRate); // cool down
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "foam", //12
|
||||
description: "spray bubbly foam that <strong>sticks</strong> to mobs<br>does <strong class='color-d'>damage</strong> over time and <strong>slows</strong> movement",
|
||||
|
||||
@@ -181,6 +181,7 @@ function collisionChecks(event) {
|
||||
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.modAcidDmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
|
||||
// console.log(obj.dmg, 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
|
||||
// console.log(obj.dmg / (0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity))))
|
||||
if (b.isModCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5
|
||||
mob[k].foundPlayer();
|
||||
|
||||
@@ -689,9 +689,6 @@ const game = {
|
||||
if (b.isModEnergyLoss) {
|
||||
mech.energy = 0.05;
|
||||
}
|
||||
|
||||
} else { //haven't killed a mob in the last 5 seconds
|
||||
|
||||
}
|
||||
|
||||
if (!(game.cycle % 420)) { //once every 7 seconds
|
||||
|
||||
10
js/level.js
10
js/level.js
@@ -14,9 +14,9 @@ const level = {
|
||||
start() {
|
||||
if (level.levelsCleared === 0) {
|
||||
// level.difficultyIncrease(9)
|
||||
// b.giveGuns("mine")
|
||||
// b.giveGuns("swarm")
|
||||
// mech.setField("time dilation field")
|
||||
// b.giveMod("irradiated needles");
|
||||
// b.giveMod("quantum immortality");
|
||||
// b.giveMod("reflective cavity");
|
||||
|
||||
level.intro(); //starting level
|
||||
@@ -136,7 +136,7 @@ const level = {
|
||||
// powerUps.spawn(950, -425, "gun", false);
|
||||
// }
|
||||
|
||||
spawn.nodeBoss(-500, -600, spawn.allowedBossList[Math.floor(Math.random() * spawn.allowedBossList.length)]);
|
||||
// spawn.nodeBoss(-500, -600, spawn.allowedBossList[Math.floor(Math.random() * spawn.allowedBossList.length)]);
|
||||
// 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);
|
||||
@@ -147,8 +147,8 @@ const level = {
|
||||
// powerUps.spawn(450, -400, "mod", false, 6);
|
||||
// powerUps.spawn(450, -400, "mod", false);
|
||||
// spawn.bodyRect(-45, -100, 40, 50);
|
||||
spawn.starter(800, -450, 150);
|
||||
// spawn.cellBoss(400, -750);
|
||||
// spawn.starter(800, -450, 150);
|
||||
spawn.laserBoss(400, -750);
|
||||
|
||||
// spawn.randomLevelBoss(400, -750)
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ const mobs = {
|
||||
x: who.position.x,
|
||||
y: who.position.y,
|
||||
radius: Math.log(2 * dmg + 1.1) * 40,
|
||||
color: `rgba(255,${Math.floor(255*Math.random())},0,0.9)`,
|
||||
color: `rgba(255,${Math.floor(200*Math.random())},0,0.9)`,
|
||||
time: game.drawTime
|
||||
});
|
||||
}
|
||||
@@ -984,8 +984,7 @@ const mobs = {
|
||||
dmg /= Math.sqrt(this.mass)
|
||||
if (this.shield) dmg *= 0.04
|
||||
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.isModHarmDamage && mech.lastHarmCycle + 300 > mech.cycle) dmg *= 2;
|
||||
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.modEnergySiphon && dmg !== Infinity) mech.energy += Math.min(this.health, dmg) * b.modEnergySiphon
|
||||
|
||||
86
js/player.js
86
js/player.js
@@ -54,6 +54,7 @@ const mech = {
|
||||
},
|
||||
cycle: 0,
|
||||
lastKillCycle: 0,
|
||||
lastHarmCycle: 0,
|
||||
width: 50,
|
||||
radius: 30,
|
||||
fillColor: "#fff", //changed by mod piezoelectric plating (damage immunity)
|
||||
@@ -249,19 +250,59 @@ const mech = {
|
||||
}
|
||||
|
||||
//horizontal move on ground
|
||||
|
||||
|
||||
|
||||
// function blink(dir) {
|
||||
// dir *= 6
|
||||
// mech.fieldCDcycle = mech.cycle + 15;
|
||||
// for (let i = 0; i < 100; i++) {
|
||||
// Matter.Body.setPosition(player, {
|
||||
// x: player.position.x + dir,
|
||||
// y: player.position.y
|
||||
// });
|
||||
// const bounds = {
|
||||
// min: {
|
||||
// x: player.bounds.min.x,
|
||||
// y: player.bounds.min.y
|
||||
// },
|
||||
// max: {
|
||||
// x: player.bounds.max.x,
|
||||
// y: player.bounds.max.y - 30
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (Matter.Query.region(map, bounds).length !== 0 || Matter.Query.region(body, bounds).length !== 0) {
|
||||
// Matter.Body.setPosition(player, {
|
||||
// x: player.position.x - dir,
|
||||
// y: player.position.y
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//apply a force to move
|
||||
if (keys[65] || keys[37]) { //left / a
|
||||
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
|
||||
// blink(-1)
|
||||
// } else {
|
||||
if (player.velocity.x > -2) {
|
||||
player.force.x -= mech.Fx * 1.5
|
||||
} else {
|
||||
player.force.x -= mech.Fx
|
||||
}
|
||||
// }
|
||||
} else if (keys[68] || keys[39]) { //right / d
|
||||
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
|
||||
// blink(1)
|
||||
// } else {
|
||||
if (player.velocity.x < 2) {
|
||||
player.force.x += mech.Fx * 1.5
|
||||
} else {
|
||||
player.force.x += mech.Fx
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
const stoppingFriction = 0.92;
|
||||
Matter.Body.setVelocity(player, {
|
||||
@@ -323,10 +364,6 @@ const mech = {
|
||||
}
|
||||
|
||||
function randomizeMods() {
|
||||
b.setupAllMods(); //remove all mods
|
||||
//remove all bullets
|
||||
for (let i = 0; i < bullet.length; ++i) Matter.World.remove(engine.world, bullet[i]);
|
||||
bullet = [];
|
||||
for (let i = 0; i < totalMods; i++) {
|
||||
//find what mods I don't have
|
||||
let options = [];
|
||||
@@ -335,6 +372,7 @@ const mech = {
|
||||
b.mods[i].name !== "quantum immortality" &&
|
||||
b.mods[i].name !== "Born rule" &&
|
||||
b.mods[i].name !== "leveraged investment" &&
|
||||
b.mods[i].name !== "reallocation" &&
|
||||
b.mods[i].allowed()
|
||||
) options.push(i);
|
||||
}
|
||||
@@ -354,7 +392,7 @@ const mech = {
|
||||
}
|
||||
|
||||
function randomizeHealth() {
|
||||
mech.health = 0.55 + Math.random()
|
||||
mech.health = 0.6 + Math.random()
|
||||
if (mech.health > 1) mech.health = 1;
|
||||
mech.displayHealth();
|
||||
}
|
||||
@@ -375,7 +413,7 @@ const mech = {
|
||||
//randomize ammo
|
||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||
if (b.guns[b.inventory[i]].ammo !== Infinity) {
|
||||
b.guns[b.inventory[i]].ammo = Math.max(0, Math.floor(6 * b.guns[b.inventory[i]].ammo * (Math.random() - 0.1)))
|
||||
b.guns[b.inventory[i]].ammo = Math.max(0, Math.floor(5 * b.guns[b.inventory[i]].ammo * (Math.random() - 0.1)))
|
||||
}
|
||||
}
|
||||
game.makeGunHUD(); //update gun HUD
|
||||
@@ -385,23 +423,29 @@ const mech = {
|
||||
ctx.fillStyle = "rgba(255,255,255,0)";
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
function randomizeEverything() {
|
||||
b.setupAllMods(); //remove all mods
|
||||
for (let i = 0; i < bullet.length; ++i) Matter.World.remove(engine.world, bullet[i]);
|
||||
bullet = []; //remove all bullets
|
||||
randomizeHealth()
|
||||
randomizeField()
|
||||
randomizeGuns()
|
||||
randomizeMods()
|
||||
}
|
||||
|
||||
randomizeEverything()
|
||||
const swapPeriod = 1000
|
||||
for (let i = 0, len = 7; i < len; i++) {
|
||||
setTimeout(function () {
|
||||
randomizeHealth()
|
||||
randomizeField()
|
||||
randomizeGuns()
|
||||
randomizeMods()
|
||||
randomizeEverything()
|
||||
game.replaceTextLog = true;
|
||||
game.makeTextLog(`probability amplitude will synchronize in ${len-i-1} seconds`, 1000);
|
||||
game.makeTextLog(`probability amplitude will synchronize in ${len-i-1} seconds`, swapPeriod);
|
||||
game.wipe = function () { //set wipe to have trails
|
||||
ctx.fillStyle = `rgba(255,255,255,${(i+1)*(i+1)*0.006})`;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
}, (i + 1) * 1000);
|
||||
}, (i + 1) * swapPeriod);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -410,7 +454,7 @@ const mech = {
|
||||
}
|
||||
game.replaceTextLog = true;
|
||||
game.makeTextLog("your quantum probability has stabilized", 1000);
|
||||
}, 8000);
|
||||
}, 8 * swapPeriod);
|
||||
|
||||
} else if (mech.alive) { //normal death code here
|
||||
mech.alive = false;
|
||||
@@ -458,6 +502,7 @@ const mech = {
|
||||
defaultFPSCycle: 0, //tracks when to return to normal fps
|
||||
collisionImmuneCycle: 0, //used in engine
|
||||
damage(dmg) {
|
||||
mech.lastHarmCycle = mech.cycle
|
||||
dmg *= mech.fieldDamageResistance
|
||||
if (b.isModEntanglement && b.inventory[0] === b.activeGun) {
|
||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||
@@ -1194,7 +1239,7 @@ const mech = {
|
||||
ctx.fillStyle = "rgba(110,170,200," + (0.06 + 0.03 * Math.random()) + ")";
|
||||
ctx.strokeStyle = "rgba(110, 200, 235, " + (0.35 + 0.05 * Math.random()) + ")"
|
||||
} else {
|
||||
ctx.fillStyle = "rgba(110,170,200," + (0.2 + 0.13 * Math.random() - 0.15 * wave) + ")";
|
||||
ctx.fillStyle = "rgba(110,170,200," + (0.27 + 0.2 * Math.random() - 0.1 * wave) + ")";
|
||||
ctx.strokeStyle = "rgba(110, 200, 235, " + (0.4 + 0.5 * Math.random()) + ")"
|
||||
}
|
||||
ctx.beginPath();
|
||||
@@ -1635,18 +1680,18 @@ const mech = {
|
||||
isEasyToAim: true,
|
||||
effect: () => {
|
||||
mech.fieldRegen *= 2;
|
||||
mech.fieldShieldingScale = b.modFieldEfficiency;
|
||||
mech.hold = function () {
|
||||
if (mech.energy > 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
|
||||
if (b.isModSporeField) {
|
||||
mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
|
||||
const len = Math.floor(6 + 3 * Math.random())
|
||||
mech.energy -= len * 0.08;
|
||||
mech.energy -= len * 0.07;
|
||||
for (let i = 0; i < len; i++) {
|
||||
b.spore(player)
|
||||
}
|
||||
} else if (b.isModMissileField) {
|
||||
mech.energy -= 0.55;
|
||||
mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
|
||||
mech.energy -= 0.5;
|
||||
b.missile({
|
||||
x: mech.pos.x + 40 * Math.cos(mech.angle),
|
||||
y: mech.pos.y + 40 * Math.sin(mech.angle) - 3
|
||||
@@ -1654,7 +1699,12 @@ const mech = {
|
||||
mech.angle + (0.5 - Math.random()) * (mech.crouch ? 0 : 0.2),
|
||||
-3 * (0.5 - Math.random()) + (mech.crouch ? 25 : -8) * b.modFireRate,
|
||||
1, b.modBabyMissiles)
|
||||
} else if (b.isModSwarmField) {
|
||||
// mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
|
||||
mech.energy -= 0.05;
|
||||
b.swarm(1)
|
||||
} else {
|
||||
mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
|
||||
mech.energy -= 0.33;
|
||||
b.drone(1)
|
||||
}
|
||||
|
||||
@@ -743,17 +743,18 @@ const spawn = {
|
||||
}
|
||||
me.dmg = 0.14 * game.dmgScale;
|
||||
me.frictionAir = 0.03;
|
||||
me.torque -= me.inertia * 0.002
|
||||
Matter.Body.rotate(me, 0.25);
|
||||
// me.torque -= me.inertia * 0.002
|
||||
Matter.Body.setDensity(me, 0.03); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
// spawn.shield(me, x, y, 1); //not working, not sure why
|
||||
me.onDeath = function () {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
};
|
||||
me.rotateVelocity = 0.0035 * Math.sqrt(game.accelScale) * (level.levelsCleared > 8 ? 1 : -1)
|
||||
me.do = function () {
|
||||
this.fill = '#' + Math.random().toString(16).substr(-6); //flash colors
|
||||
// Matter.Body.rotate(this, -0.003 / (0.3 + this.health))
|
||||
this.torque -= this.inertia * 0.0000025 / (4 + this.health);
|
||||
Matter.Body.rotate(me, this.rotateVelocity)
|
||||
// this.torque -= this.inertia * 0.0000025 / (4 + this.health);
|
||||
Matter.Body.setVelocity(this, {
|
||||
x: 0,
|
||||
y: 0
|
||||
|
||||
5
todo.txt
5
todo.txt
@@ -2,8 +2,7 @@
|
||||
|
||||
************** TODO - n-gon **************
|
||||
|
||||
desublimated ammo + mine reclaimation not fun game play interaction
|
||||
|
||||
mod - drop a mine after taking damage
|
||||
|
||||
work on burn status effect
|
||||
graphics don't look right
|
||||
@@ -28,8 +27,6 @@ dash - mod when pressing left or right on the ground, teleport to the right unt
|
||||
do repeated horizontal zone queries until they hit map or block
|
||||
up to a max range of like 10 player widths
|
||||
|
||||
bug - mech.fieldShieldingScale doesn't reset when switching fields
|
||||
|
||||
mod - blocks stun mobs
|
||||
mod or field - turn blocks into spores or drones
|
||||
|
||||
|
||||
Reference in New Issue
Block a user