diff --git a/js/bullet.js b/js/bullet.js
index 344f14f..83974cf 100644
--- a/js/bullet.js
+++ b/js/bullet.js
@@ -1021,10 +1021,11 @@ const b = {
}
},
randomBot(where = mech.pos, isKeep = true) {
- if (Math.random() < 0.2) {
- b.orbitBot(where)
- b.orbitBot(where)
- if (isKeep) mod.orbitBotCount += 2
+ if (isKeep && Math.random() < 0.2) {
+ for (let i = 0; i < 2 + mod.isOrbitBotUpgrade; i++) {
+ b.orbitBot();
+ mod.orbitBotCount++;
+ }
} else if (Math.random() < 0.25) {
b.nailBot(where)
if (isKeep) mod.nailBotCount++;
@@ -1537,13 +1538,9 @@ const b = {
},
onDmg() {},
onEnd() {},
- range: 100 + (100 + 220 * mod.isOrbitBotUpgrade) * (0.7 + 0.6 * Math.random()),
+ range: 190 + 50 * mod.isOrbitBotUpgrade, //range is set in bot upgrade too! //150 + (80 + 100 * mod.isOrbitBotUpgrade) * Math.random(), // + 5 * mod.orbitBotCount,
orbitalSpeed: 0,
phase: 2 * Math.PI * Math.random(),
- // smoothPlayerPosition: {
- // x: player.position.x,
- // y: player.position.y
- // },
do() {
//check for damage
if (!mech.isCloak && !mech.isBodiesAsleep) { //if time dilation isn't active
@@ -1561,21 +1558,33 @@ const b = {
});
}
}
-
//orbit player
const time = game.cycle * this.orbitalSpeed + this.phase
const orbit = {
x: Math.cos(time),
- y: 1.1 * Math.sin(time)
+ y: Math.sin(time) //*1.1
}
- // Matter.Body.setPosition(this, Vector.add(player.position, Vector.mult(orbit, this.range))) //bullets move with player
- // this.smoothPlayerPosition = Vector.add(Vector.mult(Vector.add(player.position, Vector.mult(player.velocity, 5)), 0.1), Vector.mult(this.smoothPlayerPosition, 0.9))
- // this.smoothPlayerPosition = Vector.add(Vector.mult(player.position, 0.1), Vector.mult(this.smoothPlayerPosition, 0.9))
- Matter.Body.setPosition(this, Vector.add(player.position, Vector.mult(orbit, this.range))) //bullets move with player
+ Matter.Body.setPosition(this, Vector.add(mech.pos, Vector.mult(orbit, this.range))) //bullets move with player
}
})
- bullet[me].orbitalSpeed = Math.sqrt(0.7 / bullet[me].range)
+ // bullet[me].orbitalSpeed = Math.sqrt(0.7 / bullet[me].range)
+ bullet[me].orbitalSpeed = Math.sqrt(0.25 / bullet[me].range) //also set in bot upgrade too!
+ // bullet[me].phase = (index / mod.orbitBotCount) * 2 * Math.PI
+
World.add(engine.world, bullet[me]); //add bullet to world
+
+ //reorder orbital bot positions around a circle
+ let totalOrbitalBots = 0
+ for (let i = 0; i < bullet.length; i++) {
+ if (bullet[i].botType === 'orbit') totalOrbitalBots++
+ }
+ let index = 0
+ for (let i = 0; i < bullet.length; i++) {
+ if (bullet[i].botType === 'orbit') {
+ bullet[i].phase = (index / totalOrbitalBots) * 2 * Math.PI
+ index++
+ }
+ }
},
// **************************************************************************************************
// **************************************************************************************************
diff --git a/js/game.js b/js/game.js
index ea2f6f0..71d55ea 100644
--- a/js/game.js
+++ b/js/game.js
@@ -510,7 +510,10 @@ const game = {
// move bots to follow player
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType) {
- Matter.Body.setPosition(bullet[i], player.position);
+ Matter.Body.setPosition(bullet[i], Vector.add(player.position, {
+ x: 250 * (Math.random() - 0.5),
+ y: 250 * (Math.random() - 0.5)
+ }));
Matter.Body.setVelocity(bullet[i], {
x: 0,
y: 0
@@ -869,7 +872,10 @@ const game = {
// move bots
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType) {
- Matter.Body.setPosition(bullet[i], player.position);
+ Matter.Body.setPosition(bullet[i], Vector.add(player.position, {
+ x: 250 * (Math.random() - 0.5),
+ y: 250 * (Math.random() - 0.5)
+ }));
Matter.Body.setVelocity(bullet[i], {
x: 0,
y: 0
diff --git a/js/level.js b/js/level.js
index ecde322..4bcea64 100644
--- a/js/level.js
+++ b/js/level.js
@@ -17,7 +17,10 @@ const level = {
// mech.isCloak = true;
// mech.setField("metamaterial cloaking")
// b.giveGuns("laser")
- // mod.giveMod("orbit-bot");
+ // for (let i = 0; i < 10; i++) {
+ // mod.giveMod("orbital-bot");
+ // }
+ // mod.giveMod("orbit-bot upgrade")
level.intro(); //starting level
@@ -4341,7 +4344,11 @@ const level = {
// move bots to follow player
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType) {
- Matter.Body.setPosition(bullet[i], this.portalPair.portal.position);
+ // Matter.Body.setPosition(bullet[i], this.portalPair.portal.position);
+ Matter.Body.setPosition(bullet[i], Vector.add(this.portalPair.portal.position, {
+ x: 250 * (Math.random() - 0.5),
+ y: 250 * (Math.random() - 0.5)
+ }));
Matter.Body.setVelocity(bullet[i], {
x: 0,
y: 0
diff --git a/js/mods.js b/js/mods.js
index 268162b..544692c 100644
--- a/js/mods.js
+++ b/js/mods.js
@@ -98,7 +98,7 @@ const mod = {
return dmg * mod.slowFire * mod.aimDamage
},
totalBots() {
- return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount + mod.orbitBotCount
+ return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount + Math.floor(mod.orbitBotCount / (2 + mod.isOrbitBotUpgrade))
},
mods: [{
name: "integrated armament",
@@ -642,7 +642,7 @@ const mod = {
},
{
name: "orbital-bot",
- description: "2 bots are locked in orbit around you
damages mobs on contact",
+ description: "2 bots are locked in orbit around you
damages mobs on contact",
maxCount: 9,
count: 0,
allowed() {
@@ -650,9 +650,10 @@ const mod = {
},
requires: "",
effect() {
- mod.orbitBotCount += 2;
- b.orbitBot();
- b.orbitBot();
+ for (let i = 0; i < 2 + mod.isOrbitBotUpgrade; i++) {
+ b.orbitBot();
+ mod.orbitBotCount++;
+ }
},
remove() {
mod.orbitBotCount = 0;
@@ -660,23 +661,32 @@ const mod = {
},
{
name: "orbit-bot upgrade",
- description: "125% increased orbital radius
applies to all current and future orbit-bots",
+ description: "get 3 orbital-bots instead of 2
applies to all current and future orbit-bots",
maxCount: 1,
count: 0,
allowed() {
return mod.orbitBotCount > 2
},
- requires: "2 or more orbit bots",
+ requires: "2 or more orbital bots",
effect() {
mod.isOrbitBotUpgrade = true
for (let i = 0; i < bullet.length; i++) {
- if (bullet[i].botType = 'orbit') bullet[i].isUpgraded = true
+ if (bullet[i].botType === 'orbit') {
+ bullet[i].isUpgraded = mod.isOrbitBotUpgrade
+ bullet[i].range = 190 + 50 * mod.isOrbitBotUpgrade
+ bullet[i].orbitalSpeed = Math.sqrt(0.25 / bullet[i].range)
+
+ }
}
+ for (let i = 0, len = Math.floor(mod.orbitBotCount / 2); i < len; i++) {
+ b.orbitBot();
+ }
+
},
remove() {
mod.isOrbitBotUpgrade = false
for (let i = 0; i < bullet.length; i++) {
- if (bullet[i].botType = 'orbit') bullet[i].isUpgraded = false
+ if (bullet[i].botType === 'orbit') bullet[i].isUpgraded = false
}
}
},
@@ -1343,7 +1353,7 @@ const mod = {
},
{
name: "catabolism",
- description: "gain ammo when you fire while out of ammo
drains 2% of max health",
+ description: "gain ammo when you fire while out of ammo
drains 2.3% of max health",
maxCount: 1,
count: 0,
allowed() {
diff --git a/js/player.js b/js/player.js
index b894538..0599761 100644
--- a/js/player.js
+++ b/js/player.js
@@ -761,8 +761,6 @@ const mech = {
},
setMaxEnergy() {
mech.maxEnergy = 1 + mod.bonusEnergy + mod.healMaxEnergyBonus
- if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy;
- mech.displayHealth();
},
fieldMeterColor: "#0cf",
drawFieldMeter(bgColor = "rgba(0, 0, 0, 0.4)", range = 60) {
@@ -2122,7 +2120,7 @@ const mech = {
y: powerUp[i].velocity.y * 0.11
});
if (dist2 < 5000 && !game.isChoosing) { //use power up if it is close enough
- if (mod.isMassEnergy) mech.energy = mech.maxEnergy * 3;
+ powerUps.onPickUp(powerUp[i].position);
powerUp[i].effect();
Matter.World.remove(engine.world, powerUp[i]);
powerUp.splice(i, 1);
diff --git a/js/spawn.js b/js/spawn.js
index 763a1c0..d8e3537 100644
--- a/js/spawn.js
+++ b/js/spawn.js
@@ -417,6 +417,8 @@ const spawn = {
stiffness: springStiffness,
damping: springDampening
});
+ World.add(engine.world, cons[cons.length - 1]);
+
cons[len].length = 100 + 1.5 * radius;
me.cons = cons[len];
@@ -431,9 +433,11 @@ const spawn = {
stiffness: springStiffness,
damping: springDampening
});
+ World.add(engine.world, cons[cons.length - 1]);
cons[len2].length = 100 + 1.5 * radius;
me.cons2 = cons[len2];
+
me.onDeath = function () {
this.removeCons();
};
diff --git a/todo.txt b/todo.txt
index 1d154fd..f3ba67b 100644
--- a/todo.txt
+++ b/todo.txt
@@ -3,6 +3,11 @@ mod: orbital-bot upgrade - orbital bots orbit farther away
************** TODO - n-gon **************
+mob: springer has a constraint issue, not pulling it
+
+mod: laser gets increased damage with each reflection
+mod: laser is 3 thick beams that look like one, but can separate into three at corners
+
getting stuck above a mob can immobilize player
just allow player to jump on mobs again?
occurs with Pauli exclusion, and time dilation field immunity - mod time-like world line