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) {
|
randomBot(where = mech.pos, isKeep = true) {
|
||||||
if (Math.random() < 0.2) {
|
if (isKeep && Math.random() < 0.2) {
|
||||||
b.orbitBot(where)
|
for (let i = 0; i < 2 + mod.isOrbitBotUpgrade; i++) {
|
||||||
b.orbitBot(where)
|
b.orbitBot();
|
||||||
if (isKeep) mod.orbitBotCount += 2
|
mod.orbitBotCount++;
|
||||||
|
}
|
||||||
} else if (Math.random() < 0.25) {
|
} else if (Math.random() < 0.25) {
|
||||||
b.nailBot(where)
|
b.nailBot(where)
|
||||||
if (isKeep) mod.nailBotCount++;
|
if (isKeep) mod.nailBotCount++;
|
||||||
@@ -1537,13 +1538,9 @@ const b = {
|
|||||||
},
|
},
|
||||||
onDmg() {},
|
onDmg() {},
|
||||||
onEnd() {},
|
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,
|
orbitalSpeed: 0,
|
||||||
phase: 2 * Math.PI * Math.random(),
|
phase: 2 * Math.PI * Math.random(),
|
||||||
// smoothPlayerPosition: {
|
|
||||||
// x: player.position.x,
|
|
||||||
// y: player.position.y
|
|
||||||
// },
|
|
||||||
do() {
|
do() {
|
||||||
//check for damage
|
//check for damage
|
||||||
if (!mech.isCloak && !mech.isBodiesAsleep) { //if time dilation isn't active
|
if (!mech.isCloak && !mech.isBodiesAsleep) { //if time dilation isn't active
|
||||||
@@ -1561,21 +1558,33 @@ const b = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//orbit player
|
//orbit player
|
||||||
const time = game.cycle * this.orbitalSpeed + this.phase
|
const time = game.cycle * this.orbitalSpeed + this.phase
|
||||||
const orbit = {
|
const orbit = {
|
||||||
x: Math.cos(time),
|
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
|
Matter.Body.setPosition(this, Vector.add(mech.pos, 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
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
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
|
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
|
// move bots to follow player
|
||||||
for (let i = 0; i < bullet.length; i++) {
|
for (let i = 0; i < bullet.length; i++) {
|
||||||
if (bullet[i].botType) {
|
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], {
|
Matter.Body.setVelocity(bullet[i], {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
@@ -869,7 +872,10 @@ const game = {
|
|||||||
// move bots
|
// move bots
|
||||||
for (let i = 0; i < bullet.length; i++) {
|
for (let i = 0; i < bullet.length; i++) {
|
||||||
if (bullet[i].botType) {
|
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], {
|
Matter.Body.setVelocity(bullet[i], {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
|
|||||||
11
js/level.js
11
js/level.js
@@ -17,7 +17,10 @@ const level = {
|
|||||||
// mech.isCloak = true;
|
// mech.isCloak = true;
|
||||||
// mech.setField("metamaterial cloaking")
|
// mech.setField("metamaterial cloaking")
|
||||||
// b.giveGuns("laser")
|
// 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
|
level.intro(); //starting level
|
||||||
@@ -4341,7 +4344,11 @@ const level = {
|
|||||||
// move bots to follow player
|
// move bots to follow player
|
||||||
for (let i = 0; i < bullet.length; i++) {
|
for (let i = 0; i < bullet.length; i++) {
|
||||||
if (bullet[i].botType) {
|
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], {
|
Matter.Body.setVelocity(bullet[i], {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
|
|||||||
30
js/mods.js
30
js/mods.js
@@ -98,7 +98,7 @@ const mod = {
|
|||||||
return dmg * mod.slowFire * mod.aimDamage
|
return dmg * mod.slowFire * mod.aimDamage
|
||||||
},
|
},
|
||||||
totalBots() {
|
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: [{
|
mods: [{
|
||||||
name: "integrated armament",
|
name: "integrated armament",
|
||||||
@@ -642,7 +642,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "orbital-bot",
|
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,
|
maxCount: 9,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -650,9 +650,10 @@ const mod = {
|
|||||||
},
|
},
|
||||||
requires: "",
|
requires: "",
|
||||||
effect() {
|
effect() {
|
||||||
mod.orbitBotCount += 2;
|
for (let i = 0; i < 2 + mod.isOrbitBotUpgrade; i++) {
|
||||||
b.orbitBot();
|
b.orbitBot();
|
||||||
b.orbitBot();
|
mod.orbitBotCount++;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
mod.orbitBotCount = 0;
|
mod.orbitBotCount = 0;
|
||||||
@@ -660,23 +661,32 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "orbit-bot upgrade",
|
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,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
return mod.orbitBotCount > 2
|
return mod.orbitBotCount > 2
|
||||||
},
|
},
|
||||||
requires: "2 or more orbit bots",
|
requires: "2 or more orbital bots",
|
||||||
effect() {
|
effect() {
|
||||||
mod.isOrbitBotUpgrade = true
|
mod.isOrbitBotUpgrade = true
|
||||||
for (let i = 0; i < bullet.length; i++) {
|
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() {
|
remove() {
|
||||||
mod.isOrbitBotUpgrade = false
|
mod.isOrbitBotUpgrade = false
|
||||||
for (let i = 0; i < bullet.length; i++) {
|
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",
|
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,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
|
|||||||
@@ -761,8 +761,6 @@ const mech = {
|
|||||||
},
|
},
|
||||||
setMaxEnergy() {
|
setMaxEnergy() {
|
||||||
mech.maxEnergy = 1 + mod.bonusEnergy + mod.healMaxEnergyBonus
|
mech.maxEnergy = 1 + mod.bonusEnergy + mod.healMaxEnergyBonus
|
||||||
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy;
|
|
||||||
mech.displayHealth();
|
|
||||||
},
|
},
|
||||||
fieldMeterColor: "#0cf",
|
fieldMeterColor: "#0cf",
|
||||||
drawFieldMeter(bgColor = "rgba(0, 0, 0, 0.4)", range = 60) {
|
drawFieldMeter(bgColor = "rgba(0, 0, 0, 0.4)", range = 60) {
|
||||||
@@ -2122,7 +2120,7 @@ const mech = {
|
|||||||
y: powerUp[i].velocity.y * 0.11
|
y: powerUp[i].velocity.y * 0.11
|
||||||
});
|
});
|
||||||
if (dist2 < 5000 && !game.isChoosing) { //use power up if it is close enough
|
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();
|
powerUp[i].effect();
|
||||||
Matter.World.remove(engine.world, powerUp[i]);
|
Matter.World.remove(engine.world, powerUp[i]);
|
||||||
powerUp.splice(i, 1);
|
powerUp.splice(i, 1);
|
||||||
|
|||||||
@@ -417,6 +417,8 @@ const spawn = {
|
|||||||
stiffness: springStiffness,
|
stiffness: springStiffness,
|
||||||
damping: springDampening
|
damping: springDampening
|
||||||
});
|
});
|
||||||
|
World.add(engine.world, cons[cons.length - 1]);
|
||||||
|
|
||||||
cons[len].length = 100 + 1.5 * radius;
|
cons[len].length = 100 + 1.5 * radius;
|
||||||
me.cons = cons[len];
|
me.cons = cons[len];
|
||||||
|
|
||||||
@@ -431,9 +433,11 @@ const spawn = {
|
|||||||
stiffness: springStiffness,
|
stiffness: springStiffness,
|
||||||
damping: springDampening
|
damping: springDampening
|
||||||
});
|
});
|
||||||
|
World.add(engine.world, cons[cons.length - 1]);
|
||||||
cons[len2].length = 100 + 1.5 * radius;
|
cons[len2].length = 100 + 1.5 * radius;
|
||||||
me.cons2 = cons[len2];
|
me.cons2 = cons[len2];
|
||||||
|
|
||||||
|
|
||||||
me.onDeath = function () {
|
me.onDeath = function () {
|
||||||
this.removeCons();
|
this.removeCons();
|
||||||
};
|
};
|
||||||
|
|||||||
5
todo.txt
5
todo.txt
@@ -3,6 +3,11 @@ mod: orbital-bot upgrade - orbital bots orbit farther away
|
|||||||
|
|
||||||
************** TODO - n-gon **************
|
************** 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
|
getting stuck above a mob can immobilize player
|
||||||
just allow player to jump on mobs again?
|
just allow player to jump on mobs again?
|
||||||
occurs with Pauli exclusion, and time dilation field immunity - mod time-like world line
|
occurs with Pauli exclusion, and time dilation field immunity - mod time-like world line
|
||||||
|
|||||||
Reference in New Issue
Block a user