bug fixes
This commit is contained in:
41
js/bullet.js
41
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++
|
||||
}
|
||||
}
|
||||
},
|
||||
// **************************************************************************************************
|
||||
// **************************************************************************************************
|
||||
|
||||
10
js/game.js
10
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
|
||||
|
||||
11
js/level.js
11
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
|
||||
|
||||
28
js/mods.js
28
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 <strong>orbit</strong> around you<br><strong class='color-d'>damages</strong> mobs on <strong>contact</strong>",
|
||||
description: "<strong>2</strong> bots are locked in <strong>orbit</strong> around you<br><strong class='color-d'>damages</strong> mobs on <strong>contact</strong>",
|
||||
maxCount: 9,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -650,9 +650,10 @@ const mod = {
|
||||
},
|
||||
requires: "",
|
||||
effect() {
|
||||
mod.orbitBotCount += 2;
|
||||
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: "<strong>125%</strong> increased orbital radius <br><em>applies to all current and future orbit-bots</em>",
|
||||
description: "get 3 orbital-bots instead of 2<br><em>applies to all current and future orbit-bots</em>",
|
||||
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 <strong class='color-g'>ammo</strong> when you <strong>fire</strong> while <strong>out</strong> of <strong class='color-g'>ammo</strong><br>drains <strong>2%</strong> of <strong>max health</strong>",
|
||||
description: "gain <strong class='color-g'>ammo</strong> when you <strong>fire</strong> while <strong>out</strong> of <strong class='color-g'>ammo</strong><br>drains <strong>2.3%</strong> of <strong>max health</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
5
todo.txt
5
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
|
||||
|
||||
Reference in New Issue
Block a user