final boss
missile moves slightly differently it used to slow when locked on to a target now it slows when turning missiles explode when near any mob wormhole mod: cosmic string - now stuns mobs and applies radiation damage mod time dilation: - quadruple your default energy regeneration added final boss level, it's still in progress so I'd love some feedback also the game loops back to the intro level after the boss I'll be working on the ending in the next patch, so the intro level is just a placeholder
This commit is contained in:
213
js/bullet.js
213
js/bullet.js
@@ -278,39 +278,42 @@ const b = {
|
|||||||
},
|
},
|
||||||
missile(where, angle, speed, size = 1, spawn = 0) {
|
missile(where, angle, speed, size = 1, spawn = 0) {
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
bullet[me] = Bodies.rectangle(where.x, where.y, 30 * size, 4 * size, b.fireAttributes(angle));
|
bullet[me] = Bodies.rectangle(where.x, where.y, 30 * size, 4 * size, {
|
||||||
const thrust = 0.00417 * bullet[me].mass;
|
angle: angle,
|
||||||
Matter.Body.setVelocity(bullet[me], {
|
friction: 0.5,
|
||||||
x: mech.Vx / 2 + speed * Math.cos(angle),
|
frictionAir: 0.045,
|
||||||
y: mech.Vy / 2 + speed * Math.sin(angle)
|
dmg: 0, //damage done in addition to the damage from momentum
|
||||||
});
|
classType: "bullet",
|
||||||
World.add(engine.world, bullet[me]); //add bullet to world
|
endCycle: game.cycle + Math.floor((230 + 40 * Math.random()) * mod.isBulletsLastLonger),
|
||||||
bullet[me].frictionAir = 0.023
|
collisionFilter: {
|
||||||
bullet[me].endCycle = game.cycle + Math.floor((280 + 40 * Math.random()) * mod.isBulletsLastLonger);
|
category: cat.bullet,
|
||||||
bullet[me].explodeRad = 170 + 60 * Math.random();
|
mask: cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield
|
||||||
bullet[me].lookFrequency = Math.floor(21 + Math.random() * 7);
|
},
|
||||||
bullet[me].onEnd = function () {
|
minDmgSpeed: 10,
|
||||||
|
lookFrequency: Math.floor(15 + Math.random() * 3),
|
||||||
|
explodeRad: 170 + 60 * Math.random(),
|
||||||
|
beforeDmg() {
|
||||||
|
this.tryToLockOn();
|
||||||
|
this.endCycle = 0; //bullet ends cycle after doing damage // also triggers explosion
|
||||||
|
}, //this.endCycle = 0 //triggers despawn
|
||||||
|
onEnd() {
|
||||||
b.explosion(this.position, this.explodeRad * size); //makes bullet do explosive damage at end
|
b.explosion(this.position, this.explodeRad * size); //makes bullet do explosive damage at end
|
||||||
if (spawn) {
|
if (spawn) {
|
||||||
for (let i = 0; i < mod.recursiveMissiles; i++) {
|
for (let i = 0; i < mod.recursiveMissiles; i++) {
|
||||||
if (0.3 - 0.03 * i > Math.random()) {
|
if (0.2 - 0.02 * i > Math.random()) {
|
||||||
b.missile(this.position, this.angle + Math.PI + 0.5 * (Math.random() - 0.5), 0, 0.33 + size, mod.recursiveMissiles)
|
b.missile(this.position, this.angle + Math.PI + 0.5 * (Math.random() - 0.5), 0, 0.33 + size, mod.recursiveMissiles)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
bullet[me].beforeDmg = function () {
|
lockedOn: null,
|
||||||
this.tryToLockOn();
|
tryToLockOn() {
|
||||||
this.endCycle = 0; //bullet ends cycle after doing damage // also triggers explosion
|
|
||||||
};
|
|
||||||
bullet[me].lockedOn = null;
|
|
||||||
bullet[me].tryToLockOn = function () {
|
|
||||||
this.lockedOn = null;
|
|
||||||
let closeDist = Infinity;
|
let closeDist = Infinity;
|
||||||
|
|
||||||
//look for closest target to where the missile will be in 30 cycles
|
//look for closest target to where the missile will be in 30 cycles
|
||||||
const futurePos = Vector.add(this.position, Vector.mult(this.velocity, 30))
|
const futurePos = Vector.add(this.position, Vector.mult(this.velocity, 50))
|
||||||
|
this.lockedOn = null;
|
||||||
|
// const futurePos = this.lockedOn ? :Vector.add(this.position, Vector.mult(this.velocity, 50))
|
||||||
for (let i = 0, len = mob.length; i < len; ++i) {
|
for (let i = 0, len = mob.length; i < len; ++i) {
|
||||||
if (
|
if (
|
||||||
mob[i].alive && mob[i].dropPowerUp &&
|
mob[i].alive && mob[i].dropPowerUp &&
|
||||||
@@ -321,25 +324,24 @@ const b = {
|
|||||||
if (futureDist < closeDist) {
|
if (futureDist < closeDist) {
|
||||||
closeDist = futureDist;
|
closeDist = futureDist;
|
||||||
this.lockedOn = mob[i];
|
this.lockedOn = mob[i];
|
||||||
this.frictionAir = 0.05; //extra friction once a target it locked
|
// this.frictionAir = 0.04; //extra friction once a target it locked
|
||||||
|
}
|
||||||
|
if (Vector.magnitude(Vector.sub(this.position, mob[i].position) < this.explodeRad)) {
|
||||||
|
this.endCycle = 0; //bullet ends cycle after doing damage //also triggers explosion
|
||||||
|
mob[i].lockedOn.damage(b.dmgScale * 2 * size); //does extra damage to target
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//explode when bullet is close enough to target
|
//explode when bullet is close enough to target
|
||||||
if (this.lockedOn && Vector.magnitude(Vector.sub(this.position, this.lockedOn.position)) < this.explodeRad) {
|
if (this.lockedOn && Vector.magnitude(Vector.sub(this.position, this.lockedOn.position)) < this.explodeRad) {
|
||||||
// console.log('hit')
|
|
||||||
this.endCycle = 0; //bullet ends cycle after doing damage //also triggers explosion
|
this.endCycle = 0; //bullet ends cycle after doing damage //also triggers explosion
|
||||||
this.lockedOn.damage(b.dmgScale * 4 * size); //does extra damage to target
|
this.lockedOn.damage(b.dmgScale * 4 * size); //does extra damage to target
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
bullet[me].do = function () {
|
do() {
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!mech.isBodiesAsleep) {
|
||||||
if (!(mech.cycle % this.lookFrequency)) {
|
if (!(mech.cycle % this.lookFrequency)) this.tryToLockOn();
|
||||||
this.tryToLockOn();
|
if (this.lockedOn) { //rotate missile towards the target
|
||||||
}
|
|
||||||
|
|
||||||
//rotate missile towards the target
|
|
||||||
if (this.lockedOn) {
|
|
||||||
const face = {
|
const face = {
|
||||||
x: Math.cos(this.angle),
|
x: Math.cos(this.angle),
|
||||||
y: Math.sin(this.angle)
|
y: Math.sin(this.angle)
|
||||||
@@ -347,10 +349,13 @@ const b = {
|
|||||||
const target = Vector.normalise(Vector.sub(this.position, this.lockedOn.position));
|
const target = Vector.normalise(Vector.sub(this.position, this.lockedOn.position));
|
||||||
if (Vector.dot(target, face) > -0.98) {
|
if (Vector.dot(target, face) > -0.98) {
|
||||||
if (Vector.cross(target, face) > 0) {
|
if (Vector.cross(target, face) > 0) {
|
||||||
Matter.Body.rotate(this, 0.08);
|
Matter.Body.rotate(this, 0.1);
|
||||||
} else {
|
} else {
|
||||||
Matter.Body.rotate(this, -0.08);
|
Matter.Body.rotate(this, -0.1);
|
||||||
}
|
}
|
||||||
|
this.frictionAir = 0.06; //extra friction if turning
|
||||||
|
} else {
|
||||||
|
this.frictionAir = 0.025; //low friction if not turning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//accelerate in direction bullet is facing
|
//accelerate in direction bullet is facing
|
||||||
@@ -358,8 +363,7 @@ const b = {
|
|||||||
this.force.x += Math.cos(dir) * thrust;
|
this.force.x += Math.cos(dir) * thrust;
|
||||||
this.force.y += Math.sin(dir) * thrust;
|
this.force.y += Math.sin(dir) * thrust;
|
||||||
|
|
||||||
//draw rocket
|
ctx.beginPath(); //draw rocket
|
||||||
ctx.beginPath();
|
|
||||||
ctx.arc(this.position.x - Math.cos(this.angle) * (25 * size - 3) + (Math.random() - 0.5) * 4,
|
ctx.arc(this.position.x - Math.cos(this.angle) * (25 * size - 3) + (Math.random() - 0.5) * 4,
|
||||||
this.position.y - Math.sin(this.angle) * (25 * size - 3) + (Math.random() - 0.5) * 4,
|
this.position.y - Math.sin(this.angle) * (25 * size - 3) + (Math.random() - 0.5) * 4,
|
||||||
11 * size, 0, 2 * Math.PI);
|
11 * size, 0, 2 * Math.PI);
|
||||||
@@ -374,7 +378,14 @@ const b = {
|
|||||||
ctx.fillStyle = "rgba(255,155,0,0.5)";
|
ctx.fillStyle = "rgba(255,155,0,0.5)";
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
});
|
||||||
|
const thrust = 0.0044 * bullet[me].mass;
|
||||||
|
Matter.Body.setVelocity(bullet[me], {
|
||||||
|
x: mech.Vx / 2 + speed * Math.cos(angle),
|
||||||
|
y: mech.Vy / 2 + speed * Math.sin(angle)
|
||||||
|
});
|
||||||
|
World.add(engine.world, bullet[me]); //add bullet to world
|
||||||
},
|
},
|
||||||
laser(where = {
|
laser(where = {
|
||||||
x: mech.pos.x + 20 * Math.cos(mech.angle),
|
x: mech.pos.x + 20 * Math.cos(mech.angle),
|
||||||
@@ -403,7 +414,7 @@ const b = {
|
|||||||
y: whereEnd.y
|
y: whereEnd.y
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const vertexCollision = function (v1, v1End, domain) {
|
const vertexCollision = function(v1, v1End, domain) {
|
||||||
for (let i = 0; i < domain.length; ++i) {
|
for (let i = 0; i < domain.length; ++i) {
|
||||||
let vertices = domain[i].vertices;
|
let vertices = domain[i].vertices;
|
||||||
const len = vertices.length - 1;
|
const len = vertices.length - 1;
|
||||||
@@ -444,7 +455,7 @@ const b = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkForCollisions = function () {
|
const checkForCollisions = function() {
|
||||||
best = {
|
best = {
|
||||||
x: null,
|
x: null,
|
||||||
y: null,
|
y: null,
|
||||||
@@ -457,7 +468,7 @@ const b = {
|
|||||||
vertexCollision(path[path.length - 2], path[path.length - 1], map);
|
vertexCollision(path[path.length - 2], path[path.length - 1], map);
|
||||||
vertexCollision(path[path.length - 2], path[path.length - 1], body);
|
vertexCollision(path[path.length - 2], path[path.length - 1], body);
|
||||||
};
|
};
|
||||||
const laserHitMob = function () {
|
const laserHitMob = function() {
|
||||||
if (best.who.alive) {
|
if (best.who.alive) {
|
||||||
best.who.damage(damage);
|
best.who.damage(damage);
|
||||||
best.who.locatePlayer();
|
best.who.locatePlayer();
|
||||||
@@ -474,7 +485,7 @@ const b = {
|
|||||||
// ctx.arc(path[path.length - 1].x, path[path.length - 1].y, Math.sqrt(damage) * 100, 0, 2 * Math.PI);
|
// ctx.arc(path[path.length - 1].x, path[path.length - 1].y, Math.sqrt(damage) * 100, 0, 2 * Math.PI);
|
||||||
// ctx.fill();
|
// ctx.fill();
|
||||||
};
|
};
|
||||||
const reflection = function () { // https://math.stackexchange.com/questions/13261/how-to-get-a-reflection-vector
|
const reflection = function() { // https://math.stackexchange.com/questions/13261/how-to-get-a-reflection-vector
|
||||||
const n = Vector.perp(Vector.normalise(Vector.sub(best.v1, best.v2)));
|
const n = Vector.perp(Vector.normalise(Vector.sub(best.v1, best.v2)));
|
||||||
const d = Vector.sub(path[path.length - 1], path[path.length - 2]);
|
const d = Vector.sub(path[path.length - 1], path[path.length - 2]);
|
||||||
const nn = Vector.mult(n, 2 * Vector.dot(d, n));
|
const nn = Vector.mult(n, 2 * Vector.dot(d, n));
|
||||||
@@ -587,7 +598,7 @@ const b = {
|
|||||||
|
|
||||||
//sometimes the mine can't attach to map and it just needs to be reset
|
//sometimes the mine can't attach to map and it just needs to be reset
|
||||||
const that = this
|
const that = this
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
if (Matter.Query.collides(that, map).length === 0 || Matter.Query.point(map, that.position).length > 0) {
|
if (Matter.Query.collides(that, map).length === 0 || Matter.Query.point(map, that.position).length > 0) {
|
||||||
// console.log(that)
|
// console.log(that)
|
||||||
that.endCycle = 0 // if not touching map explode
|
that.endCycle = 0 // if not touching map explode
|
||||||
@@ -612,7 +623,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
arm() {
|
arm() {
|
||||||
this.lookFrequency = game.cycle + 60
|
this.lookFrequency = game.cycle + 60
|
||||||
this.do = function () { //overwrite the do method for this bullet
|
this.do = function() { //overwrite the do method for this bullet
|
||||||
this.force.y += this.mass * 0.002; //extra gravity
|
this.force.y += this.mass * 0.002; //extra gravity
|
||||||
|
|
||||||
if (game.cycle > this.lookFrequency) {
|
if (game.cycle > this.lookFrequency) {
|
||||||
@@ -626,7 +637,7 @@ const b = {
|
|||||||
color: "#f00",
|
color: "#f00",
|
||||||
time: 4
|
time: 4
|
||||||
});
|
});
|
||||||
this.do = function () { //overwrite the do method for this bullet
|
this.do = function() { //overwrite the do method for this bullet
|
||||||
this.force.y += this.mass * 0.002; //extra gravity
|
this.force.y += this.mass * 0.002; //extra gravity
|
||||||
if (!(game.cycle % this.lookFrequency)) { //find mob targets
|
if (!(game.cycle % this.lookFrequency)) { //find mob targets
|
||||||
for (let i = 0, len = mob.length; i < len; ++i) {
|
for (let i = 0, len = mob.length; i < len; ++i) {
|
||||||
@@ -806,7 +817,7 @@ const b = {
|
|||||||
this.endCycle = game.cycle
|
this.endCycle = game.cycle
|
||||||
if (mod.isHeavyWater) mobs.statusDoT(who, 0.15, 300)
|
if (mod.isHeavyWater) mobs.statusDoT(who, 0.15, 300)
|
||||||
if (mod.iceEnergy && !who.shield && !who.isShielded && who.dropPowerUp && who.alive) {
|
if (mod.iceEnergy && !who.shield && !who.isShielded && who.dropPowerUp && who.alive) {
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
if (!who.alive) {
|
if (!who.alive) {
|
||||||
mech.energy += mod.iceEnergy * 0.66 * mech.maxEnergy
|
mech.energy += mod.iceEnergy * 0.66 * mech.maxEnergy
|
||||||
mech.addHealth(mod.iceEnergy * 0.04)
|
mech.addHealth(mod.iceEnergy * 0.04)
|
||||||
@@ -1164,11 +1175,11 @@ const b = {
|
|||||||
World.add(engine.world, bullet[me]); //add bullet to world
|
World.add(engine.world, bullet[me]); //add bullet to world
|
||||||
bullet[me].endCycle = game.cycle + 60 + 18 * Math.random();
|
bullet[me].endCycle = game.cycle + 60 + 18 * Math.random();
|
||||||
bullet[me].dmg = dmg
|
bullet[me].dmg = dmg
|
||||||
bullet[me].beforeDmg = function (who) { //beforeDmg is rewritten with ice crystal mod
|
bullet[me].beforeDmg = function(who) { //beforeDmg is rewritten with ice crystal mod
|
||||||
if (mod.isNailPoison) mobs.statusDoT(who, dmg * 0.22, 120) // one tick every 30 cycles
|
if (mod.isNailPoison) mobs.statusDoT(who, dmg * 0.22, 120) // one tick every 30 cycles
|
||||||
if (mod.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.99) this.dmg *= 5 //crit if hit near center
|
if (mod.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.99) this.dmg *= 5 //crit if hit near center
|
||||||
};
|
};
|
||||||
bullet[me].do = function () {};
|
bullet[me].do = function() {};
|
||||||
},
|
},
|
||||||
// **************************************************************************************************
|
// **************************************************************************************************
|
||||||
// **************************************************************************************************
|
// **************************************************************************************************
|
||||||
@@ -1302,7 +1313,7 @@ const b = {
|
|||||||
const radius = 6 + 7 * Math.random()
|
const radius = 6 + 7 * Math.random()
|
||||||
const SPEED = 29 - radius * 0.5; //(mech.crouch ? 32 : 20) - radius * 0.7;
|
const SPEED = 29 - radius * 0.5; //(mech.crouch ? 32 : 20) - radius * 0.7;
|
||||||
const velocity = Vector.mult(Vector.normalise(Vector.sub(target, this.position)), SPEED)
|
const velocity = Vector.mult(Vector.normalise(Vector.sub(target, this.position)), SPEED)
|
||||||
b.foam(this.position, velocity, radius + 14 * this.isUpgraded)
|
b.foam(this.position, velocity, radius + 9 * this.isUpgraded)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1582,7 +1593,7 @@ const b = {
|
|||||||
y: this.position.y + range * unit.y
|
y: this.position.y + range * unit.y
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const vertexCollision = function (v1, v1End, domain) {
|
const vertexCollision = function(v1, v1End, domain) {
|
||||||
for (let i = 0; i < domain.length; ++i) {
|
for (let i = 0; i < domain.length; ++i) {
|
||||||
let vertices = domain[i].vertices;
|
let vertices = domain[i].vertices;
|
||||||
const len = vertices.length - 1;
|
const len = vertices.length - 1;
|
||||||
@@ -1713,8 +1724,21 @@ const b = {
|
|||||||
mask: 0 //cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
|
mask: 0 //cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
|
||||||
},
|
},
|
||||||
beforeDmg() {},
|
beforeDmg() {},
|
||||||
onEnd() {},
|
onEnd() {
|
||||||
range: 190 + 50 * mod.isOrbitBotUpgrade, //range is set in bot upgrade too! //150 + (80 + 100 * mod.isOrbitBotUpgrade) * Math.random(), // + 5 * mod.orbitBotCount,
|
//reorder orbital bot positions around a circle
|
||||||
|
let totalOrbitalBots = 0
|
||||||
|
for (let i = 0; i < bullet.length; i++) {
|
||||||
|
if (bullet[i].botType === 'orbit' && bullet[i] !== this) totalOrbitalBots++
|
||||||
|
}
|
||||||
|
let index = 0
|
||||||
|
for (let i = 0; i < bullet.length; i++) {
|
||||||
|
if (bullet[i].botType === 'orbit' && bullet[i] !== this) {
|
||||||
|
bullet[i].phase = (index / totalOrbitalBots) * 2 * Math.PI
|
||||||
|
index++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
range: 190 + 60 * 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(),
|
||||||
do() {
|
do() {
|
||||||
@@ -1735,7 +1759,7 @@ const b = {
|
|||||||
})
|
})
|
||||||
for (let i = 0; i < q.length; i++) {
|
for (let i = 0; i < q.length; i++) {
|
||||||
mobs.statusStun(q[i], 180)
|
mobs.statusStun(q[i], 180)
|
||||||
const dmg = 0.5 * b.dmgScale * (this.isUpgraded ? 2.25 : 1) * (mod.isCrit ? 4 : 1)
|
const dmg = 0.5 * b.dmgScale * (this.isUpgraded ? 2 : 1) * (mod.isCrit ? 4 : 1)
|
||||||
q[i].damage(dmg);
|
q[i].damage(dmg);
|
||||||
q[i].foundPlayer();
|
q[i].foundPlayer();
|
||||||
game.drawList.push({ //add dmg to draw queue
|
game.drawList.push({ //add dmg to draw queue
|
||||||
@@ -1759,7 +1783,6 @@ const b = {
|
|||||||
// 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].orbitalSpeed = Math.sqrt(0.25 / bullet[me].range) //also set in bot upgrade too!
|
||||||
// bullet[me].phase = (index / mod.orbitBotCount) * 2 * Math.PI
|
// 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
|
//reorder orbital bot positions around a circle
|
||||||
@@ -1856,7 +1879,7 @@ const b = {
|
|||||||
y: mech.Vy / 2 + speed * Math.sin(angle)
|
y: mech.Vy / 2 + speed * Math.sin(angle)
|
||||||
}, dmg) //position, velocity, damage
|
}, dmg) //position, velocity, damage
|
||||||
if (mod.isIceCrystals) {
|
if (mod.isIceCrystals) {
|
||||||
bullet[bullet.length - 1].beforeDmg = function (who) {
|
bullet[bullet.length - 1].beforeDmg = function(who) {
|
||||||
mobs.statusSlow(who, 30)
|
mobs.statusSlow(who, 30)
|
||||||
if (mod.isNailPoison) mobs.statusDoT(who, dmg * 0.22, 120) // one tick every 30 cycles
|
if (mod.isNailPoison) mobs.statusDoT(who, dmg * 0.22, 120) // one tick every 30 cycles
|
||||||
if (mod.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.99) this.dmg *= 5 //crit if hit near center
|
if (mod.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.99) this.dmg *= 5 //crit if hit near center
|
||||||
@@ -1927,7 +1950,7 @@ const b = {
|
|||||||
bullet[me].minDmgSpeed = 15
|
bullet[me].minDmgSpeed = 15
|
||||||
// bullet[me].restitution = 0.4
|
// bullet[me].restitution = 0.4
|
||||||
bullet[me].frictionAir = 0.034;
|
bullet[me].frictionAir = 0.034;
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!mech.isBodiesAsleep) {
|
||||||
const scale = 1 - 0.034 / mod.isBulletsLastLonger
|
const scale = 1 - 0.034 / mod.isBulletsLastLonger
|
||||||
Matter.Body.scale(this, scale, scale);
|
Matter.Body.scale(this, scale, scale);
|
||||||
@@ -1961,10 +1984,10 @@ const b = {
|
|||||||
bullet[me].minDmgSpeed = 0;
|
bullet[me].minDmgSpeed = 0;
|
||||||
bullet[me].restitution = 1;
|
bullet[me].restitution = 1;
|
||||||
bullet[me].friction = 0;
|
bullet[me].friction = 0;
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
this.force.y += this.mass * 0.001;
|
this.force.y += this.mass * 0.001;
|
||||||
};
|
};
|
||||||
bullet[me].beforeDmg = function (who) {
|
bullet[me].beforeDmg = function(who) {
|
||||||
mobs.statusStun(who, 180) // (2.3) * 2 / 14 ticks (2x damage over 7 seconds)
|
mobs.statusStun(who, 180) // (2.3) * 2 / 14 ticks (2x damage over 7 seconds)
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -1984,7 +2007,7 @@ const b = {
|
|||||||
bullet[me].minDmgSpeed = 0;
|
bullet[me].minDmgSpeed = 0;
|
||||||
bullet[me].restitution = 0.99;
|
bullet[me].restitution = 0.99;
|
||||||
bullet[me].friction = 0;
|
bullet[me].friction = 0;
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
this.force.y += this.mass * 0.001;
|
this.force.y += this.mass * 0.001;
|
||||||
};
|
};
|
||||||
dir += SPREAD;
|
dir += SPREAD;
|
||||||
@@ -2010,7 +2033,7 @@ const b = {
|
|||||||
bullet[me].endCycle = game.cycle + 180;
|
bullet[me].endCycle = game.cycle + 180;
|
||||||
bullet[me].dmg = 0;
|
bullet[me].dmg = 0;
|
||||||
bullet[me].immuneList = []
|
bullet[me].immuneList = []
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
const whom = Matter.Query.collides(this, mob)
|
const whom = Matter.Query.collides(this, mob)
|
||||||
if (whom.length && this.speed > 20) { //if touching a mob
|
if (whom.length && this.speed > 20) { //if touching a mob
|
||||||
who = whom[0].bodyA
|
who = whom[0].bodyA
|
||||||
@@ -2065,7 +2088,7 @@ const b = {
|
|||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
});
|
});
|
||||||
this.do = function () {}
|
this.do = function() {}
|
||||||
} else if (this.speed < 30) {
|
} else if (this.speed < 30) {
|
||||||
this.force.y += this.mass * 0.0007; //no gravity until it slows down to improve aiming
|
this.force.y += this.mass * 0.0007; //no gravity until it slows down to improve aiming
|
||||||
}
|
}
|
||||||
@@ -2140,7 +2163,7 @@ const b = {
|
|||||||
// check if inside a mob
|
// check if inside a mob
|
||||||
q = Matter.Query.point(mob, this.position)
|
q = Matter.Query.point(mob, this.position)
|
||||||
for (let i = 0; i < q.length; i++) {
|
for (let i = 0; i < q.length; i++) {
|
||||||
let dmg = b.dmgScale * 0.36 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.66) //1 - 0.4 = 0.6 for helix mod 40% damage reduction
|
let dmg = b.dmgScale * 0.36 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.8) //1 - 0.4 = 0.6 for helix mod 40% damage reduction
|
||||||
q[i].damage(dmg);
|
q[i].damage(dmg);
|
||||||
q[i].foundPlayer();
|
q[i].foundPlayer();
|
||||||
game.drawList.push({ //add dmg to draw queue
|
game.drawList.push({ //add dmg to draw queue
|
||||||
@@ -2173,7 +2196,7 @@ const b = {
|
|||||||
for (let i = 0; i < q.length; i++) {
|
for (let i = 0; i < q.length; i++) {
|
||||||
slowCheck = 0.3;
|
slowCheck = 0.3;
|
||||||
Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium
|
Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium
|
||||||
let dmg = b.dmgScale * 0.36 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.66) //1 - 0.4 = 0.6 for helix mod 40% damage reduction
|
let dmg = b.dmgScale * 0.36 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.8) //1 - 0.4 = 0.6 for helix mod 40% damage reduction
|
||||||
q[i].damage(dmg);
|
q[i].damage(dmg);
|
||||||
q[i].foundPlayer();
|
q[i].foundPlayer();
|
||||||
game.drawList.push({ //add dmg to draw queue
|
game.drawList.push({ //add dmg to draw queue
|
||||||
@@ -2243,7 +2266,7 @@ const b = {
|
|||||||
fire() {
|
fire() {
|
||||||
if (mod.is3Missiles) {
|
if (mod.is3Missiles) {
|
||||||
if (mech.crouch) {
|
if (mech.crouch) {
|
||||||
mech.fireCDcycle = mech.cycle + 60 * b.fireCD; // cool down
|
mech.fireCDcycle = mech.cycle + 50 * b.fireCD; // cool down
|
||||||
const direction = {
|
const direction = {
|
||||||
x: Math.cos(mech.angle),
|
x: Math.cos(mech.angle),
|
||||||
y: Math.sin(mech.angle)
|
y: Math.sin(mech.angle)
|
||||||
@@ -2259,7 +2282,7 @@ const b = {
|
|||||||
bullet[bullet.length - 1].force.y += push.y * (i - 1);
|
bullet[bullet.length - 1].force.y += push.y * (i - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mech.fireCDcycle = mech.cycle + 45 * b.fireCD; // cool down
|
mech.fireCDcycle = mech.cycle + 35 * b.fireCD; // cool down
|
||||||
const direction = {
|
const direction = {
|
||||||
x: Math.cos(mech.angle),
|
x: Math.cos(mech.angle),
|
||||||
y: Math.sin(mech.angle)
|
y: Math.sin(mech.angle)
|
||||||
@@ -2276,7 +2299,7 @@ const b = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mech.fireCDcycle = mech.cycle + Math.floor(mech.crouch ? 45 : 30) * b.fireCD; // cool down
|
mech.fireCDcycle = mech.cycle + Math.floor(mech.crouch ? 40 : 25) * b.fireCD; // cool down
|
||||||
b.missile({
|
b.missile({
|
||||||
x: mech.pos.x + 40 * Math.cos(mech.angle),
|
x: mech.pos.x + 40 * Math.cos(mech.angle),
|
||||||
y: mech.pos.y + 40 * Math.sin(mech.angle) - 3
|
y: mech.pos.y + 40 * Math.sin(mech.angle) - 3
|
||||||
@@ -2318,13 +2341,13 @@ const b = {
|
|||||||
bullet[me].restitution = 0;
|
bullet[me].restitution = 0;
|
||||||
bullet[me].friction = 1;
|
bullet[me].friction = 1;
|
||||||
bullet[me].explodeRad = (mech.crouch ? 95 : 75) + (Math.random() - 0.5) * 50;
|
bullet[me].explodeRad = (mech.crouch ? 95 : 75) + (Math.random() - 0.5) * 50;
|
||||||
bullet[me].onEnd = function () {
|
bullet[me].onEnd = function() {
|
||||||
b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end
|
b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end
|
||||||
}
|
}
|
||||||
bullet[me].beforeDmg = function () {
|
bullet[me].beforeDmg = function() {
|
||||||
this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion
|
this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion
|
||||||
};
|
};
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
// this.force.y += this.mass * 0.0004;
|
// this.force.y += this.mass * 0.0004;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2345,12 +2368,12 @@ const b = {
|
|||||||
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, b.fireAttributes(dir, false));
|
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, b.fireAttributes(dir, false));
|
||||||
Matter.Body.setDensity(bullet[me], 0.0005);
|
Matter.Body.setDensity(bullet[me], 0.0005);
|
||||||
bullet[me].explodeRad = 275;
|
bullet[me].explodeRad = 275;
|
||||||
bullet[me].onEnd = function () {
|
bullet[me].onEnd = function() {
|
||||||
b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end
|
b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end
|
||||||
if (mod.grenadeFragments) b.targetedNail(this.position, mod.grenadeFragments)
|
if (mod.grenadeFragments) b.targetedNail(this.position, mod.grenadeFragments)
|
||||||
}
|
}
|
||||||
bullet[me].minDmgSpeed = 1;
|
bullet[me].minDmgSpeed = 1;
|
||||||
bullet[me].beforeDmg = function () {
|
bullet[me].beforeDmg = function() {
|
||||||
this.endCycle = 0; //bullet ends cycle after doing damage //this also triggers explosion
|
this.endCycle = 0; //bullet ends cycle after doing damage //this also triggers explosion
|
||||||
};
|
};
|
||||||
if (mod.isRPG) {
|
if (mod.isRPG) {
|
||||||
@@ -2362,7 +2385,7 @@ const b = {
|
|||||||
x: bullet[me].mass * MAG * Math.cos(dir),
|
x: bullet[me].mass * MAG * Math.cos(dir),
|
||||||
y: bullet[me].mass * MAG * Math.sin(dir)
|
y: bullet[me].mass * MAG * Math.sin(dir)
|
||||||
}
|
}
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
this.force.x += this.thrust.x;
|
this.force.x += this.thrust.x;
|
||||||
this.force.y += this.thrust.y;
|
this.force.y += this.thrust.y;
|
||||||
if (Matter.Query.collides(this, map).length || Matter.Query.collides(this, body).length) {
|
if (Matter.Query.collides(this, map).length || Matter.Query.collides(this, body).length) {
|
||||||
@@ -2373,7 +2396,7 @@ const b = {
|
|||||||
b.fireProps(mech.crouch ? 40 : 30, mech.crouch ? 43 : 32, dir, me); //cd , speed
|
b.fireProps(mech.crouch ? 40 : 30, mech.crouch ? 43 : 32, dir, me); //cd , speed
|
||||||
bullet[me].endCycle = game.cycle + Math.floor(mech.crouch ? 120 : 80);
|
bullet[me].endCycle = game.cycle + Math.floor(mech.crouch ? 120 : 80);
|
||||||
bullet[me].restitution = 0.4;
|
bullet[me].restitution = 0.4;
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
this.force.y += this.mass * 0.0025; //extra gravity for harder arcs
|
this.force.y += this.mass * 0.0025; //extra gravity for harder arcs
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -2384,16 +2407,16 @@ const b = {
|
|||||||
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, b.fireAttributes(dir, false));
|
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, b.fireAttributes(dir, false));
|
||||||
Matter.Body.setDensity(bullet[me], 0.0003);
|
Matter.Body.setDensity(bullet[me], 0.0003);
|
||||||
bullet[me].explodeRad = 350 + Math.floor(Math.random() * 50);;
|
bullet[me].explodeRad = 350 + Math.floor(Math.random() * 50);;
|
||||||
bullet[me].onEnd = function () {
|
bullet[me].onEnd = function() {
|
||||||
b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end
|
b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end
|
||||||
if (mod.grenadeFragments) b.targetedNail(this.position, mod.grenadeFragments)
|
if (mod.grenadeFragments) b.targetedNail(this.position, mod.grenadeFragments)
|
||||||
}
|
}
|
||||||
bullet[me].beforeDmg = function () {};
|
bullet[me].beforeDmg = function() {};
|
||||||
const cd = mech.crouch ? 90 : 75
|
const cd = mech.crouch ? 90 : 75
|
||||||
b.fireProps(cd, mech.crouch ? 46 : 35, dir, me); //cd , speed
|
b.fireProps(cd, mech.crouch ? 46 : 35, dir, me); //cd , speed
|
||||||
bullet[me].endCycle = game.cycle + cd;
|
bullet[me].endCycle = game.cycle + cd;
|
||||||
bullet[me].restitution = 0.4;
|
bullet[me].restitution = 0.4;
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
this.force.y += this.mass * 0.0025; //extra gravity for harder arcs
|
this.force.y += this.mass * 0.0025; //extra gravity for harder arcs
|
||||||
|
|
||||||
const suckCycles = 40
|
const suckCycles = 40
|
||||||
@@ -2464,9 +2487,9 @@ const b = {
|
|||||||
bullet[me].maxDamageRadius = (435 + 150 * Math.random()) * (mod.isNeutronImmune ? 1.2 : 1)
|
bullet[me].maxDamageRadius = (435 + 150 * Math.random()) * (mod.isNeutronImmune ? 1.2 : 1)
|
||||||
bullet[me].stuckTo = null;
|
bullet[me].stuckTo = null;
|
||||||
bullet[me].stuckToRelativePosition = null;
|
bullet[me].stuckToRelativePosition = null;
|
||||||
bullet[me].beforeDmg = function () {};
|
bullet[me].beforeDmg = function() {};
|
||||||
bullet[me].stuck = function () {};
|
bullet[me].stuck = function() {};
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
function onCollide(that) {
|
function onCollide(that) {
|
||||||
that.collisionFilter.mask = 0; //non collide with everything
|
that.collisionFilter.mask = 0; //non collide with everything
|
||||||
Matter.Body.setVelocity(that, {
|
Matter.Body.setVelocity(that, {
|
||||||
@@ -2511,14 +2534,14 @@ const b = {
|
|||||||
//find the relative position for when the mob is at angle zero by undoing the mobs rotation
|
//find the relative position for when the mob is at angle zero by undoing the mobs rotation
|
||||||
this.stuckToRelativePosition = Vector.rotate(Vector.sub(this.position, this.stuckTo.position), -this.stuckTo.angle)
|
this.stuckToRelativePosition = Vector.rotate(Vector.sub(this.position, this.stuckTo.position), -this.stuckTo.angle)
|
||||||
}
|
}
|
||||||
this.stuck = function () {
|
this.stuck = function() {
|
||||||
if (this.stuckTo && this.stuckTo.alive) {
|
if (this.stuckTo && this.stuckTo.alive) {
|
||||||
const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle) //add in the mob's new angle to the relative position vector
|
const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle) //add in the mob's new angle to the relative position vector
|
||||||
Matter.Body.setPosition(this, Vector.add(Vector.add(rotate, this.stuckTo.velocity), this.stuckTo.position))
|
Matter.Body.setPosition(this, Vector.add(Vector.add(rotate, this.stuckTo.velocity), this.stuckTo.position))
|
||||||
Matter.Body.setVelocity(this, this.stuckTo.velocity); //so that it will move properly if it gets unstuck
|
Matter.Body.setVelocity(this, this.stuckTo.velocity); //so that it will move properly if it gets unstuck
|
||||||
} else {
|
} else {
|
||||||
this.collisionFilter.mask = cat.map | cat.body | cat.player | cat.mob; //non collide with everything but map
|
this.collisionFilter.mask = cat.map | cat.body | cat.player | cat.mob; //non collide with everything but map
|
||||||
this.stuck = function () {
|
this.stuck = function() {
|
||||||
this.force.y += this.mass * 0.001;
|
this.force.y += this.mass * 0.001;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2534,7 +2557,7 @@ const b = {
|
|||||||
} else {
|
} else {
|
||||||
this.do = this.radiationMode;
|
this.do = this.radiationMode;
|
||||||
}
|
}
|
||||||
this.stuck = function () {
|
this.stuck = function() {
|
||||||
if (this.stuckTo) {
|
if (this.stuckTo) {
|
||||||
const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle) //add in the mob's new angle to the relative position vector
|
const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle) //add in the mob's new angle to the relative position vector
|
||||||
Matter.Body.setPosition(this, Vector.add(Vector.add(rotate, this.stuckTo.velocity), this.stuckTo.position))
|
Matter.Body.setPosition(this, Vector.add(Vector.add(rotate, this.stuckTo.velocity), this.stuckTo.position))
|
||||||
@@ -2552,7 +2575,7 @@ const b = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bullet[me].radiationMode = function () {
|
bullet[me].radiationMode = function() {
|
||||||
this.stuck(); //runs different code based on what the bullet is stuck to
|
this.stuck(); //runs different code based on what the bullet is stuck to
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!mech.isBodiesAsleep) {
|
||||||
this.damageRadius = this.damageRadius * 0.85 + 0.15 * this.maxDamageRadius //smooth radius towards max
|
this.damageRadius = this.damageRadius * 0.85 + 0.15 * this.maxDamageRadius //smooth radius towards max
|
||||||
@@ -2634,9 +2657,9 @@ const b = {
|
|||||||
bullet[me].restitution = 0.3;
|
bullet[me].restitution = 0.3;
|
||||||
bullet[me].minDmgSpeed = 0;
|
bullet[me].minDmgSpeed = 0;
|
||||||
bullet[me].totalSpores = 8 + 2 * mod.isFastSpores + 2 * mod.isSporeFreeze
|
bullet[me].totalSpores = 8 + 2 * mod.isFastSpores + 2 * mod.isSporeFreeze
|
||||||
bullet[me].stuck = function () {};
|
bullet[me].stuck = function() {};
|
||||||
bullet[me].beforeDmg = function () {};
|
bullet[me].beforeDmg = function() {};
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
function onCollide(that) {
|
function onCollide(that) {
|
||||||
that.collisionFilter.mask = 0; //non collide with everything
|
that.collisionFilter.mask = 0; //non collide with everything
|
||||||
Matter.Body.setVelocity(that, {
|
Matter.Body.setVelocity(that, {
|
||||||
@@ -2660,14 +2683,14 @@ const b = {
|
|||||||
//find the relative position for when the mob is at angle zero by undoing the mobs rotation
|
//find the relative position for when the mob is at angle zero by undoing the mobs rotation
|
||||||
this.stuckToRelativePosition = Vector.rotate(Vector.sub(this.position, this.stuckTo.position), -this.stuckTo.angle)
|
this.stuckToRelativePosition = Vector.rotate(Vector.sub(this.position, this.stuckTo.position), -this.stuckTo.angle)
|
||||||
}
|
}
|
||||||
this.stuck = function () {
|
this.stuck = function() {
|
||||||
if (this.stuckTo && this.stuckTo.alive) {
|
if (this.stuckTo && this.stuckTo.alive) {
|
||||||
const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle) //add in the mob's new angle to the relative position vector
|
const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle) //add in the mob's new angle to the relative position vector
|
||||||
Matter.Body.setPosition(this, Vector.add(Vector.add(rotate, this.stuckTo.velocity), this.stuckTo.position))
|
Matter.Body.setPosition(this, Vector.add(Vector.add(rotate, this.stuckTo.velocity), this.stuckTo.position))
|
||||||
Matter.Body.setVelocity(this, this.stuckTo.velocity); //so that it will move properly if it gets unstuck
|
Matter.Body.setVelocity(this, this.stuckTo.velocity); //so that it will move properly if it gets unstuck
|
||||||
} else {
|
} else {
|
||||||
this.collisionFilter.mask = cat.map; //non collide with everything but map
|
this.collisionFilter.mask = cat.map; //non collide with everything but map
|
||||||
this.stuck = function () {
|
this.stuck = function() {
|
||||||
this.force.y += this.mass * 0.0006;
|
this.force.y += this.mass * 0.0006;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2683,7 +2706,7 @@ const b = {
|
|||||||
} else {
|
} else {
|
||||||
this.do = this.grow;
|
this.do = this.grow;
|
||||||
}
|
}
|
||||||
this.stuck = function () {
|
this.stuck = function() {
|
||||||
if (this.stuckTo) {
|
if (this.stuckTo) {
|
||||||
const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle) //add in the mob's new angle to the relative position vector
|
const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle) //add in the mob's new angle to the relative position vector
|
||||||
Matter.Body.setPosition(this, Vector.add(Vector.add(rotate, this.stuckTo.velocity), this.stuckTo.position))
|
Matter.Body.setPosition(this, Vector.add(Vector.add(rotate, this.stuckTo.velocity), this.stuckTo.position))
|
||||||
@@ -2707,7 +2730,7 @@ const b = {
|
|||||||
ctx.fill();
|
ctx.fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
bullet[me].grow = function () {
|
bullet[me].grow = function() {
|
||||||
this.stuck(); //runs different code based on what the bullet is stuck to
|
this.stuck(); //runs different code based on what the bullet is stuck to
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!mech.isBodiesAsleep) {
|
||||||
let scale = 1.01
|
let scale = 1.01
|
||||||
@@ -2736,7 +2759,7 @@ const b = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//spawn bullets on end
|
//spawn bullets on end
|
||||||
bullet[me].onEnd = function () {
|
bullet[me].onEnd = function() {
|
||||||
const NUM = this.totalSpores
|
const NUM = this.totalSpores
|
||||||
for (let i = 0; i < NUM; i++) {
|
for (let i = 0; i < NUM; i++) {
|
||||||
b.spore(this.position)
|
b.spore(this.position)
|
||||||
@@ -2958,7 +2981,7 @@ const b = {
|
|||||||
World.add(engine.world, bullet[me]); //add bullet to world
|
World.add(engine.world, bullet[me]); //add bullet to world
|
||||||
bullet[me].endCycle = Infinity
|
bullet[me].endCycle = Infinity
|
||||||
bullet[me].charge = 0;
|
bullet[me].charge = 0;
|
||||||
bullet[me].do = function () {
|
bullet[me].do = function() {
|
||||||
if (mech.energy < 0.005 && !mod.isRailTimeSlow) {
|
if (mech.energy < 0.005 && !mod.isRailTimeSlow) {
|
||||||
mech.energy += 0.05 + this.charge * 0.3
|
mech.energy += 0.05 + this.charge * 0.3
|
||||||
mech.fireCDcycle = mech.cycle + 120; // cool down if out of energy
|
mech.fireCDcycle = mech.cycle + 120; // cool down if out of energy
|
||||||
@@ -2969,7 +2992,7 @@ const b = {
|
|||||||
if ((!input.fire && this.charge > 0.6)) { //fire on mouse release or on low energy
|
if ((!input.fire && this.charge > 0.6)) { //fire on mouse release or on low energy
|
||||||
mech.fireCDcycle = mech.cycle + 2; // set fire cool down
|
mech.fireCDcycle = mech.cycle + 2; // set fire cool down
|
||||||
//normal bullet behavior occurs after firing, overwrites this function
|
//normal bullet behavior occurs after firing, overwrites this function
|
||||||
this.do = function () {
|
this.do = function() {
|
||||||
this.force.y += this.mass * 0.0003 / this.charge; // low gravity that scales with charge
|
this.force.y += this.mass * 0.0003 / this.charge; // low gravity that scales with charge
|
||||||
}
|
}
|
||||||
if (mod.isRailTimeSlow) {
|
if (mod.isRailTimeSlow) {
|
||||||
@@ -3046,7 +3069,7 @@ const b = {
|
|||||||
y: mech.pos.y + range * Math.sin(dir)
|
y: mech.pos.y + range * Math.sin(dir)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const vertexCollision = function (v1, v1End, domain) {
|
const vertexCollision = function(v1, v1End, domain) {
|
||||||
for (let i = 0; i < domain.length; ++i) {
|
for (let i = 0; i < domain.length; ++i) {
|
||||||
let vertices = domain[i].vertices;
|
let vertices = domain[i].vertices;
|
||||||
const len = vertices.length - 1;
|
const len = vertices.length - 1;
|
||||||
@@ -3257,7 +3280,7 @@ const b = {
|
|||||||
y: mech.pos.y + range * Math.sin(angle)
|
y: mech.pos.y + range * Math.sin(angle)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const vertexCollision = function (v1, v1End, domain) {
|
const vertexCollision = function(v1, v1End, domain) {
|
||||||
for (let i = 0; i < domain.length; ++i) {
|
for (let i = 0; i < domain.length; ++i) {
|
||||||
let vertices = domain[i].vertices;
|
let vertices = domain[i].vertices;
|
||||||
const len = vertices.length - 1;
|
const len = vertices.length - 1;
|
||||||
|
|||||||
125
js/game.js
125
js/game.js
@@ -459,70 +459,14 @@ const game = {
|
|||||||
addGravity(body, game.g);
|
addGravity(body, game.g);
|
||||||
player.force.y += player.mass * game.g;
|
player.force.y += player.mass * game.g;
|
||||||
},
|
},
|
||||||
reset() { //run on first run, and each later run after you die
|
// reset() { //run on first run, and each later run after you die
|
||||||
input.endKeySensing();
|
|
||||||
b.removeAllGuns();
|
|
||||||
game.isNoPowerUps = false;
|
|
||||||
mod.setupAllMods(); //sets mods to default values
|
|
||||||
b.setFireCD();
|
|
||||||
game.updateModHUD();
|
|
||||||
powerUps.totalPowerUps = 0;
|
|
||||||
powerUps.reroll.rerolls = 0;
|
|
||||||
mech.setFillColors();
|
|
||||||
mech.maxHealth = 1
|
|
||||||
mech.maxEnergy = 1
|
|
||||||
mech.energy = 1
|
|
||||||
mech.hole.isOn = false
|
|
||||||
game.paused = false;
|
|
||||||
engine.timing.timeScale = 1;
|
|
||||||
game.fpsCap = game.fpsCapDefault;
|
|
||||||
game.isAutoZoom = true;
|
|
||||||
game.makeGunHUD();
|
|
||||||
mech.drop();
|
|
||||||
mech.holdingTarget = null
|
|
||||||
mech.addHealth(Infinity);
|
|
||||||
mech.alive = true;
|
|
||||||
level.onLevel = 0;
|
|
||||||
level.levelsCleared = 0;
|
|
||||||
|
|
||||||
//resetting difficulty
|
// },
|
||||||
game.dmgScale = 0; //increases in level.difficultyIncrease
|
|
||||||
b.dmgScale = 1; //decreases in level.difficultyIncrease
|
|
||||||
game.accelScale = 1;
|
|
||||||
game.lookFreqScale = 1;
|
|
||||||
game.CDScale = 1;
|
|
||||||
game.difficulty = 0;
|
|
||||||
game.difficultyMode = Number(document.getElementById("difficulty-select").value)
|
|
||||||
build.isCustomSelection = false;
|
|
||||||
// if (game.difficultyMode > 2) {
|
|
||||||
// level.difficultyIncrease(game.difficultyMode)
|
|
||||||
// level.difficultyIncrease(game.difficultyMode)
|
|
||||||
// }
|
|
||||||
|
|
||||||
game.clearNow = true;
|
|
||||||
document.getElementById("text-log").style.opacity = 0;
|
|
||||||
document.getElementById("fade-out").style.opacity = 0;
|
|
||||||
document.title = "n-gon";
|
|
||||||
//set to default field
|
|
||||||
mech.fieldMode = 0;
|
|
||||||
game.replaceTextLog = true;
|
|
||||||
game.makeTextLog(`${game.SVGrightMouse}<strong style='font-size:30px;'> ${mech.fieldUpgrades[mech.fieldMode].name}</strong><br><span class='faded'></span><br>${mech.fieldUpgrades[mech.fieldMode].description}`, 600);
|
|
||||||
mech.setField(mech.fieldMode)
|
|
||||||
//exit testing
|
|
||||||
if (game.testing) {
|
|
||||||
game.testing = false;
|
|
||||||
game.loop = game.normalLoop
|
|
||||||
if (game.isConstructionMode) {
|
|
||||||
document.getElementById("construct").style.display = 'none'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
game.isCheating = false
|
|
||||||
},
|
|
||||||
firstRun: true,
|
firstRun: true,
|
||||||
splashReturn() {
|
splashReturn() {
|
||||||
game.onTitlePage = true;
|
game.onTitlePage = true;
|
||||||
// document.getElementById('splash').onclick = 'run(this)';
|
// document.getElementById('splash').onclick = 'run(this)';
|
||||||
document.getElementById("splash").onclick = function () {
|
document.getElementById("splash").onclick = function() {
|
||||||
game.startGame();
|
game.startGame();
|
||||||
};
|
};
|
||||||
document.getElementById("choose-grid").style.display = "none"
|
document.getElementById("choose-grid").style.display = "none"
|
||||||
@@ -553,8 +497,8 @@ const game = {
|
|||||||
document.getElementById("dmg").style.display = "inline";
|
document.getElementById("dmg").style.display = "inline";
|
||||||
document.getElementById("health-bg").style.display = "inline";
|
document.getElementById("health-bg").style.display = "inline";
|
||||||
|
|
||||||
if (game.firstRun) {
|
|
||||||
mech.spawn(); //spawns the player
|
mech.spawn(); //spawns the player
|
||||||
|
|
||||||
if (game.isCommunityMaps) {
|
if (game.isCommunityMaps) {
|
||||||
level.levels.push("stronghold");
|
level.levels.push("stronghold");
|
||||||
level.levels.push("basement");
|
level.levels.push("basement");
|
||||||
@@ -562,9 +506,64 @@ const game = {
|
|||||||
level.levels.push("house");
|
level.levels.push("house");
|
||||||
}
|
}
|
||||||
level.levels = shuffle(level.levels); //shuffles order of maps
|
level.levels = shuffle(level.levels); //shuffles order of maps
|
||||||
level.levels.unshift("bosses"); //add bosses level to the end of the randomized levels list
|
level.levels.unshift("intro"); //add level to the start of the randomized levels list
|
||||||
|
level.levels.push("gauntlet"); //add level to the end of the randomized levels list
|
||||||
|
level.levels.push("finalBoss"); //add level to the end of the randomized levels list
|
||||||
|
|
||||||
|
input.endKeySensing();
|
||||||
|
b.removeAllGuns();
|
||||||
|
game.isNoPowerUps = false;
|
||||||
|
mod.setupAllMods(); //sets mods to default values
|
||||||
|
b.setFireCD();
|
||||||
|
game.updateModHUD();
|
||||||
|
powerUps.totalPowerUps = 0;
|
||||||
|
powerUps.reroll.rerolls = 0;
|
||||||
|
mech.setFillColors();
|
||||||
|
mech.maxHealth = 1
|
||||||
|
mech.maxEnergy = 1
|
||||||
|
mech.energy = 1
|
||||||
|
mech.hole.isOn = false
|
||||||
|
game.paused = false;
|
||||||
|
engine.timing.timeScale = 1;
|
||||||
|
game.fpsCap = game.fpsCapDefault;
|
||||||
|
game.isAutoZoom = true;
|
||||||
|
game.makeGunHUD();
|
||||||
|
mech.drop();
|
||||||
|
mech.holdingTarget = null
|
||||||
|
mech.health = 0.25;
|
||||||
|
mech.displayHealth();
|
||||||
|
mech.alive = true;
|
||||||
|
level.onLevel = 0;
|
||||||
|
level.levelsCleared = 0;
|
||||||
|
|
||||||
|
//resetting difficulty
|
||||||
|
game.dmgScale = 0; //increases in level.difficultyIncrease
|
||||||
|
b.dmgScale = 1; //decreases in level.difficultyIncrease
|
||||||
|
game.accelScale = 1;
|
||||||
|
game.lookFreqScale = 1;
|
||||||
|
game.CDScale = 1;
|
||||||
|
game.difficulty = 0;
|
||||||
|
game.difficultyMode = Number(document.getElementById("difficulty-select").value)
|
||||||
|
build.isCustomSelection = false;
|
||||||
|
|
||||||
|
game.clearNow = true;
|
||||||
|
document.getElementById("text-log").style.opacity = 0;
|
||||||
|
document.getElementById("fade-out").style.opacity = 0;
|
||||||
|
document.title = "n-gon";
|
||||||
|
//set to default field
|
||||||
|
mech.fieldMode = 0;
|
||||||
|
game.replaceTextLog = true;
|
||||||
|
game.makeTextLog(`${game.SVGrightMouse}<strong style='font-size:30px;'> ${mech.fieldUpgrades[mech.fieldMode].name}</strong><br><span class='faded'></span><br>${mech.fieldUpgrades[mech.fieldMode].description}`, 600);
|
||||||
|
mech.setField(mech.fieldMode)
|
||||||
|
//exit testing
|
||||||
|
if (game.testing) {
|
||||||
|
game.testing = false;
|
||||||
|
game.loop = game.normalLoop
|
||||||
|
if (game.isConstructionMode) {
|
||||||
|
document.getElementById("construct").style.display = 'none'
|
||||||
}
|
}
|
||||||
game.reset();
|
}
|
||||||
|
game.isCheating = false
|
||||||
game.firstRun = false;
|
game.firstRun = false;
|
||||||
|
|
||||||
//setup FPS cap
|
//setup FPS cap
|
||||||
@@ -744,7 +743,7 @@ const game = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(game.cycle % 420)) { //once every 7 seconds
|
if (!(game.cycle % 420)) { //once every 7 seconds
|
||||||
fallCheck = function (who, save = false) {
|
fallCheck = function(who, save = false) {
|
||||||
let i = who.length;
|
let i = who.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if (who[i].position.y > game.fallHeight) {
|
if (who[i].position.y > game.fallHeight) {
|
||||||
|
|||||||
14
js/index.js
14
js/index.js
@@ -53,7 +53,7 @@ if (screen.height < 800) {
|
|||||||
//difficulty is 0 easy, 1 normal, 2 hard, 4 why
|
//difficulty is 0 easy, 1 normal, 2 hard, 4 why
|
||||||
function getUrlVars() {
|
function getUrlVars() {
|
||||||
let vars = {};
|
let vars = {};
|
||||||
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, k, v) {
|
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, k, v) {
|
||||||
vars[k] = v;
|
vars[k] = v;
|
||||||
});
|
});
|
||||||
return vars;
|
return vars;
|
||||||
@@ -122,7 +122,7 @@ const ctx = canvas.getContext("2d");
|
|||||||
document.body.style.backgroundColor = "#fff";
|
document.body.style.backgroundColor = "#fff";
|
||||||
|
|
||||||
//disable pop up menu on right click
|
//disable pop up menu on right click
|
||||||
document.oncontextmenu = function () {
|
document.oncontextmenu = function() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ const build = {
|
|||||||
<br>position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)}) velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
|
<br>position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)}) velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
|
||||||
<br>mouse: (${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)}) mass: ${player.mass.toFixed(1)}
|
<br>mouse: (${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)}) mass: ${player.mass.toFixed(1)}
|
||||||
<br>
|
<br>
|
||||||
<br>level: ${level.levelsCleared} - ${level.levelsCleared===0?"intro":level.levels[level.onLevel]} (${level.difficultyText()}) ${mech.cycle} cycles
|
<br>level: ${level.levels[level.onLevel]} (${level.difficultyText()}) ${mech.cycle} cycles
|
||||||
<br>${mob.length} mobs, ${body.length} blocks, ${bullet.length} bullets, ${powerUp.length} power ups
|
<br>${mob.length} mobs, ${body.length} blocks, ${bullet.length} bullets, ${powerUp.length} power ups
|
||||||
<br>damage difficulty scale: ${(b.dmgScale*100).toFixed(2) }%
|
<br>damage difficulty scale: ${(b.dmgScale*100).toFixed(2) }%
|
||||||
<br>harm difficulty scale: ${(game.dmgScale*100).toFixed(0)}%
|
<br>harm difficulty scale: ${(game.dmgScale*100).toFixed(0)}%
|
||||||
@@ -642,14 +642,14 @@ document.getElementById("control-table").addEventListener('click', (event) => {
|
|||||||
window.addEventListener("keydown", input.setKeys);
|
window.addEventListener("keydown", input.setKeys);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document.getElementById("control-details").addEventListener("toggle", function () {
|
document.getElementById("control-details").addEventListener("toggle", function() {
|
||||||
input.controlTextUpdate()
|
input.controlTextUpdate()
|
||||||
input.endKeySensing();
|
input.endKeySensing();
|
||||||
})
|
})
|
||||||
|
|
||||||
document.getElementById("control-reset").addEventListener('click', input.setDefault);
|
document.getElementById("control-reset").addEventListener('click', input.setDefault);
|
||||||
|
|
||||||
window.addEventListener("keyup", function (event) {
|
window.addEventListener("keyup", function(event) {
|
||||||
switch (event.code) {
|
switch (event.code) {
|
||||||
case input.key.right:
|
case input.key.right:
|
||||||
case "ArrowRight":
|
case "ArrowRight":
|
||||||
@@ -673,7 +673,7 @@ window.addEventListener("keyup", function (event) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("keydown", function (event) {
|
window.addEventListener("keydown", function(event) {
|
||||||
switch (event.code) {
|
switch (event.code) {
|
||||||
case input.key.right:
|
case input.key.right:
|
||||||
case "ArrowRight":
|
case "ArrowRight":
|
||||||
@@ -703,7 +703,7 @@ window.addEventListener("keydown", function (event) {
|
|||||||
case input.key.pause:
|
case input.key.pause:
|
||||||
if (!game.isChoosing && input.isPauseKeyReady && mech.alive) {
|
if (!game.isChoosing && input.isPauseKeyReady && mech.alive) {
|
||||||
input.isPauseKeyReady = false
|
input.isPauseKeyReady = false
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
input.isPauseKeyReady = true
|
input.isPauseKeyReady = true
|
||||||
}, 300);
|
}, 300);
|
||||||
if (game.paused) {
|
if (game.paused) {
|
||||||
|
|||||||
1143
js/level.js
1143
js/level.js
File diff suppressed because it is too large
Load Diff
102
js/mods.js
102
js/mods.js
@@ -87,12 +87,12 @@ const mod = {
|
|||||||
if (mod.isDamageForGuns) dmg *= 1 + 0.07 * b.inventory.length
|
if (mod.isDamageForGuns) dmg *= 1 + 0.07 * b.inventory.length
|
||||||
if (mod.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, 1 - mech.health)
|
if (mod.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, 1 - mech.health)
|
||||||
if (mod.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 2;
|
if (mod.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 2;
|
||||||
if (mod.isEnergyLoss) dmg *= 1.43;
|
if (mod.isEnergyLoss) dmg *= 1.5;
|
||||||
if (mod.isAcidDmg && mech.health > 1) dmg *= 1.4;
|
if (mod.isAcidDmg && mech.health > 1) dmg *= 1.4;
|
||||||
if (mod.restDamage > 1 && player.speed < 1) dmg *= mod.restDamage
|
if (mod.restDamage > 1 && player.speed < 1) dmg *= mod.restDamage
|
||||||
if (mod.isEnergyDamage) dmg *= 1 + mech.energy / 5.5;
|
if (mod.isEnergyDamage) dmg *= 1 + mech.energy / 5.5;
|
||||||
if (mod.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038
|
if (mod.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038
|
||||||
if (mod.isRerollDamage) dmg *= 1 + 0.05 * powerUps.reroll.rerolls
|
if (mod.isRerollDamage) dmg *= 1 + 0.06 * powerUps.reroll.rerolls
|
||||||
if (mod.isOneGun && b.inventory.length < 2) dmg *= 1.25
|
if (mod.isOneGun && b.inventory.length < 2) dmg *= 1.25
|
||||||
if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.5
|
if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.5
|
||||||
return dmg * mod.slowFire * mod.aimDamage
|
return dmg * mod.slowFire * mod.aimDamage
|
||||||
@@ -149,7 +149,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "acute stress response",
|
name: "acute stress response",
|
||||||
description: "increase <strong class='color-d'>damage</strong> by <strong>43%</strong><br>if a mob <strong>dies</strong> drain stored <strong class='color-f'>energy</strong> by <strong>25%</strong>",
|
description: "increase <strong class='color-d'>damage</strong> by <strong>50%</strong><br>if a mob <strong>dies</strong> drain stored <strong class='color-f'>energy</strong> by <strong>25%</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -245,7 +245,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "perturbation theory",
|
name: "perturbation theory",
|
||||||
description: "increase <strong class='color-d'>damage</strong> by <strong>5%</strong><br>for each of your <strong class='color-r'>rerolls</strong>",
|
description: "increase <strong class='color-d'>damage</strong> by <strong>6%</strong><br>for each of your <strong class='color-r'>rerolls</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -259,26 +259,6 @@ const mod = {
|
|||||||
mod.isRerollDamage = false;
|
mod.isRerollDamage = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "Ψ(t) collapse",
|
|
||||||
description: "<strong>60%</strong> decreased <strong>delay</strong> after firing<br>if you have no <strong class='color-r'>rerolls</strong>",
|
|
||||||
maxCount: 1,
|
|
||||||
count: 0,
|
|
||||||
allowed() {
|
|
||||||
return powerUps.reroll.rerolls === 0 && !mod.manyWorlds
|
|
||||||
},
|
|
||||||
requires: "no rerolls",
|
|
||||||
effect() {
|
|
||||||
mod.isRerollHaste = true;
|
|
||||||
mod.rerollHaste = 0.4;
|
|
||||||
b.setFireCD();
|
|
||||||
},
|
|
||||||
remove() {
|
|
||||||
mod.isRerollHaste = false;
|
|
||||||
mod.rerollHaste = 1;
|
|
||||||
b.setFireCD();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "electrostatic discharge",
|
name: "electrostatic discharge",
|
||||||
description: "increase <strong class='color-d'>damage</strong> by <strong>20%</strong><br><strong>20%</strong> increased <strong>delay</strong> after firing",
|
description: "increase <strong class='color-d'>damage</strong> by <strong>20%</strong><br><strong>20%</strong> increased <strong>delay</strong> after firing",
|
||||||
@@ -296,6 +276,26 @@ const mod = {
|
|||||||
b.setFireCD();
|
b.setFireCD();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Ψ(t) collapse",
|
||||||
|
description: "<strong>66%</strong> decreased <strong>delay</strong> after firing<br>if you have no <strong class='color-r'>rerolls</strong>",
|
||||||
|
maxCount: 1,
|
||||||
|
count: 0,
|
||||||
|
allowed() {
|
||||||
|
return powerUps.reroll.rerolls === 0 && !mod.manyWorlds
|
||||||
|
},
|
||||||
|
requires: "no rerolls",
|
||||||
|
effect() {
|
||||||
|
mod.isRerollHaste = true;
|
||||||
|
mod.rerollHaste = 0.33;
|
||||||
|
b.setFireCD();
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
mod.isRerollHaste = false;
|
||||||
|
mod.rerollHaste = 1;
|
||||||
|
b.setFireCD();
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "auto-loading heuristics",
|
name: "auto-loading heuristics",
|
||||||
description: "<strong>30%</strong> decreased <strong>delay</strong> after firing",
|
description: "<strong>30%</strong> decreased <strong>delay</strong> after firing",
|
||||||
@@ -558,7 +558,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "foam-bot upgrade",
|
name: "foam-bot upgrade",
|
||||||
description: "<strong>200%</strong> increased <strong>foam size</strong><br><em>applies to all current and future foam-bots</em>",
|
description: "<strong>150%</strong> increased <strong>foam size</strong><br><em>applies to all current and future foam-bots</em>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -675,7 +675,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "orbital-bot upgrade",
|
name: "orbital-bot upgrade",
|
||||||
description: "<strong>125%</strong> increased <strong class='color-d'>damage</strong><br><em>applies to all current and future orbit-bots</em>",
|
description: "increase <strong class='color-d'>damage</strong> by <strong>100%</strong> and <strong>radius</strong> by <strong>30%</strong><br><em>applies to all current and future orbit-bots</em>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -684,15 +684,24 @@ const mod = {
|
|||||||
requires: "2 or more orbital bots",
|
requires: "2 or more orbital bots",
|
||||||
effect() {
|
effect() {
|
||||||
mod.isOrbitBotUpgrade = true
|
mod.isOrbitBotUpgrade = true
|
||||||
|
const range = 190 + 60 * mod.isOrbitBotUpgrade
|
||||||
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 = true
|
||||||
|
bullet[i].range = range
|
||||||
|
bullet[i].orbitalSpeed = Math.sqrt(0.25 / range)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
mod.isOrbitBotUpgrade = false
|
mod.isOrbitBotUpgrade = false
|
||||||
|
const range = 190 + 60 * mod.isOrbitBotUpgrade
|
||||||
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].range = range
|
||||||
|
bullet[i].orbitalSpeed = Math.sqrt(0.25 / range)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -946,7 +955,7 @@ const mod = {
|
|||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
return mod.isPiezo
|
return mod.isPiezo && !mod.timeEnergyRegen
|
||||||
},
|
},
|
||||||
requires: "piezoelectricity",
|
requires: "piezoelectricity",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
@@ -1169,7 +1178,7 @@ const mod = {
|
|||||||
name: "anthropic principle",
|
name: "anthropic principle",
|
||||||
nameInfo: "<span id = 'mod-anthropic'></span>",
|
nameInfo: "<span id = 'mod-anthropic'></span>",
|
||||||
addNameInfo() {
|
addNameInfo() {
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
powerUps.reroll.changeRerolls(0)
|
powerUps.reroll.changeRerolls(0)
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
@@ -1182,7 +1191,7 @@ const mod = {
|
|||||||
requires: "at least 1 reroll",
|
requires: "at least 1 reroll",
|
||||||
effect() {
|
effect() {
|
||||||
mod.isDeathAvoid = true;
|
mod.isDeathAvoid = true;
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
powerUps.reroll.changeRerolls(0)
|
powerUps.reroll.changeRerolls(0)
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
@@ -1254,7 +1263,7 @@ const mod = {
|
|||||||
name: "entanglement",
|
name: "entanglement",
|
||||||
nameInfo: "<span id = 'mod-entanglement'></span>",
|
nameInfo: "<span id = 'mod-entanglement'></span>",
|
||||||
addNameInfo() {
|
addNameInfo() {
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
game.boldActiveGunHUD();
|
game.boldActiveGunHUD();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
@@ -1267,7 +1276,7 @@ const mod = {
|
|||||||
requires: "at least 2 guns",
|
requires: "at least 2 guns",
|
||||||
effect() {
|
effect() {
|
||||||
mod.isEntanglement = true
|
mod.isEntanglement = true
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
game.boldActiveGunHUD();
|
game.boldActiveGunHUD();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
@@ -1893,7 +1902,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wave packet",
|
name: "wave packet",
|
||||||
description: "<strong>wave beam</strong> emits <strong>two</strong> oscillating particles<br>decrease wave <strong class='color-d'>damage</strong> by <strong>33%</strong>",
|
description: "<strong>wave beam</strong> emits <strong>two</strong> oscillating particles<br>decrease wave <strong class='color-d'>damage</strong> by <strong>20%</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -1943,7 +1952,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "recursion",
|
name: "recursion",
|
||||||
description: "after <strong>missiles</strong> <strong class='color-e'>explode</strong> they have a<br><strong>30%</strong> chance to launch a larger <strong>missile</strong>",
|
description: "after <strong>missiles</strong> <strong class='color-e'>explode</strong> they have a<br><strong>20%</strong> chance to launch a larger <strong>missile</strong>",
|
||||||
maxCount: 6,
|
maxCount: 6,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -2622,6 +2631,24 @@ const mod = {
|
|||||||
b.setFireCD();
|
b.setFireCD();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "time crystals",
|
||||||
|
description: "<strong>quadruple</strong> your default <strong class='color-f'>energy</strong> regeneration",
|
||||||
|
maxCount: 1,
|
||||||
|
count: 0,
|
||||||
|
allowed() {
|
||||||
|
return mech.fieldUpgrades[mech.fieldMode].name === "time dilation field"
|
||||||
|
},
|
||||||
|
requires: "time dilation field",
|
||||||
|
effect: () => {
|
||||||
|
mod.energyRegen = 0.004;
|
||||||
|
mech.fieldRegen = mod.energyRegen;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
mod.energyRegen = 0.001;
|
||||||
|
mech.fieldRegen = mod.energyRegen;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "plasma jet",
|
name: "plasma jet",
|
||||||
description: "increase <strong class='color-plasma'>plasma</strong> <strong>torch's</strong> range by <strong>27%</strong>",
|
description: "increase <strong class='color-plasma'>plasma</strong> <strong>torch's</strong> range by <strong>27%</strong>",
|
||||||
@@ -2871,7 +2898,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cosmic string",
|
name: "cosmic string",
|
||||||
description: "when you <strong> tunnel</strong> through a <strong class='color-worm'>wormhole</strong><br>mobs between the <strong>endpoints</strong> take <strong class='color-d'>damage</strong>",
|
description: "<strong>stun</strong> and do <strong class='color-p'>radioactive</strong> <strong class='color-d'>damage</strong> to <strong>mobs</strong><br>if you tunnel through them with a <strong class='color-worm'>wormhole</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -3178,5 +3205,6 @@ const mod = {
|
|||||||
isWormBullets: null,
|
isWormBullets: null,
|
||||||
isWideLaser: null,
|
isWideLaser: null,
|
||||||
wideLaser: null,
|
wideLaser: null,
|
||||||
isPulseLaser: null
|
isPulseLaser: null,
|
||||||
|
timeEnergyRegen: null
|
||||||
}
|
}
|
||||||
97
js/player.js
97
js/player.js
@@ -373,7 +373,7 @@ const mech = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
game.wipe = function () { //set wipe to have trails
|
game.wipe = function() { //set wipe to have trails
|
||||||
ctx.fillStyle = "rgba(255,255,255,0)";
|
ctx.fillStyle = "rgba(255,255,255,0)";
|
||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
// pixelWindows()
|
// pixelWindows()
|
||||||
@@ -395,11 +395,11 @@ const mech = {
|
|||||||
randomizeEverything()
|
randomizeEverything()
|
||||||
const swapPeriod = 1000
|
const swapPeriod = 1000
|
||||||
for (let i = 0, len = 5; i < len; i++) {
|
for (let i = 0, len = 5; i < len; i++) {
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
randomizeEverything()
|
randomizeEverything()
|
||||||
game.replaceTextLog = true;
|
game.replaceTextLog = true;
|
||||||
game.makeTextLog(`probability amplitude will synchronize in ${len-i-1} seconds`, swapPeriod);
|
game.makeTextLog(`probability amplitude will synchronize in ${len-i-1} seconds`, swapPeriod);
|
||||||
game.wipe = function () { //set wipe to have trails
|
game.wipe = function() { //set wipe to have trails
|
||||||
ctx.fillStyle = `rgba(255,255,255,${(i+1)*(i+1)*0.006})`;
|
ctx.fillStyle = `rgba(255,255,255,${(i+1)*(i+1)*0.006})`;
|
||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
// pixelWindows()
|
// pixelWindows()
|
||||||
@@ -407,8 +407,8 @@ const mech = {
|
|||||||
}, (i + 1) * swapPeriod);
|
}, (i + 1) * swapPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
game.wipe = function () { //set wipe to normal
|
game.wipe = function() { //set wipe to normal
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
game.replaceTextLog = true;
|
game.replaceTextLog = true;
|
||||||
@@ -422,7 +422,7 @@ const mech = {
|
|||||||
mech.displayHealth();
|
mech.displayHealth();
|
||||||
document.getElementById("text-log").style.opacity = 0; //fade out any active text logs
|
document.getElementById("text-log").style.opacity = 0; //fade out any active text logs
|
||||||
document.getElementById("fade-out").style.opacity = 1; //slowly fades out
|
document.getElementById("fade-out").style.opacity = 1; //slowly fades out
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
game.splashReturn();
|
game.splashReturn();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
@@ -503,12 +503,12 @@ const mech = {
|
|||||||
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420)
|
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420)
|
||||||
mech.energy = mech.maxEnergy
|
mech.energy = mech.maxEnergy
|
||||||
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds
|
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds
|
||||||
game.wipe = function () { //set wipe to have trails
|
game.wipe = function() { //set wipe to have trails
|
||||||
ctx.fillStyle = "rgba(255,255,255,0.03)";
|
ctx.fillStyle = "rgba(255,255,255,0.03)";
|
||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
game.wipe = function () { //set wipe to normal
|
game.wipe = function() { //set wipe to normal
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
@@ -535,12 +535,12 @@ const mech = {
|
|||||||
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds
|
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds
|
||||||
// game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420)
|
// game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420)
|
||||||
|
|
||||||
game.wipe = function () { //set wipe to have trails
|
game.wipe = function() { //set wipe to have trails
|
||||||
ctx.fillStyle = "rgba(255,255,255,0.03)";
|
ctx.fillStyle = "rgba(255,255,255,0.03)";
|
||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
game.wipe = function () { //set wipe to normal
|
game.wipe = function() { //set wipe to normal
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
@@ -557,7 +557,7 @@ const mech = {
|
|||||||
|
|
||||||
if (dmg > 0.06 / mech.holdingMassScale) mech.drop(); //drop block if holding
|
if (dmg > 0.06 / mech.holdingMassScale) mech.drop(); //drop block if holding
|
||||||
|
|
||||||
const normalFPS = function () {
|
const normalFPS = function() {
|
||||||
if (mech.defaultFPSCycle < mech.cycle) { //back to default values
|
if (mech.defaultFPSCycle < mech.cycle) { //back to default values
|
||||||
game.fpsCap = game.fpsCapDefault
|
game.fpsCap = game.fpsCapDefault
|
||||||
game.fpsInterval = 1000 / game.fpsCap;
|
game.fpsInterval = 1000 / game.fpsCap;
|
||||||
@@ -918,7 +918,7 @@ const mech = {
|
|||||||
mech.holdingTarget.collisionFilter.category = cat.body; //cat.bullet;
|
mech.holdingTarget.collisionFilter.category = cat.body; //cat.bullet;
|
||||||
mech.holdingTarget.collisionFilter.mask = cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield;
|
mech.holdingTarget.collisionFilter.mask = cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield;
|
||||||
//check every second to see if player is away from thrown body, and make solid
|
//check every second to see if player is away from thrown body, and make solid
|
||||||
const solid = function (that) {
|
const solid = function(that) {
|
||||||
const dx = that.position.x - player.position.x;
|
const dx = that.position.x - player.position.x;
|
||||||
const dy = that.position.y - player.position.y;
|
const dy = that.position.y - player.position.y;
|
||||||
if (dx * dx + dy * dy > 10000 && that !== mech.holdingTarget) {
|
if (dx * dx + dy * dy > 10000 && that !== mech.holdingTarget) {
|
||||||
@@ -1122,31 +1122,6 @@ const mech = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// pushBodyFacing() { // push all body in range and in direction looking
|
|
||||||
// for (let i = 0, len = body.length; i < len; ++i) {
|
|
||||||
// if (
|
|
||||||
// body[i].speed > 12 && body[i].mass > 2 &&
|
|
||||||
// Vector.magnitude(Vector.sub(body[i].position, mech.pos)) < mech.fieldRange &&
|
|
||||||
// mech.lookingAt(body[i]) &&
|
|
||||||
// Matter.Query.ray(map, body[i].position, mech.pos).length === 0
|
|
||||||
// ) {
|
|
||||||
// mech.pushMass(body[i]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// pushBody360(range = mech.fieldRange * 0.75) { // push all body in range and in direction looking
|
|
||||||
// for (let i = 0, len = body.length; i < len; ++i) {
|
|
||||||
// if (
|
|
||||||
// body[i].speed > 12 && body[i].mass > 2 &&
|
|
||||||
// Vector.magnitude(Vector.sub(body[i].position, mech.pos)) < range &&
|
|
||||||
// mech.lookingAt(body[i]) &&
|
|
||||||
// Matter.Query.ray(map, body[i].position, mech.pos).length === 0 &&
|
|
||||||
// body[i].collisionFilter.category === cat.body
|
|
||||||
// ) {
|
|
||||||
// mech.pushMass(body[i]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
lookForPickUp() { //find body to pickup
|
lookForPickUp() { //find body to pickup
|
||||||
if (mech.energy > mech.fieldRegen) mech.energy -= mech.fieldRegen;
|
if (mech.energy > mech.fieldRegen) mech.energy -= mech.fieldRegen;
|
||||||
const grabbing = {
|
const grabbing = {
|
||||||
@@ -1250,7 +1225,7 @@ const mech = {
|
|||||||
description: "use <strong class='color-f'>energy</strong> to <strong>block</strong> mobs<br><strong>throw</strong> blocks to <strong class='color-d'>damage</strong> mobs<br><strong>pick up</strong> power ups",
|
description: "use <strong class='color-f'>energy</strong> to <strong>block</strong> mobs<br><strong>throw</strong> blocks to <strong class='color-d'>damage</strong> mobs<br><strong>pick up</strong> power ups",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
game.replaceTextLog = true; //allow text over write
|
game.replaceTextLog = true; //allow text over write
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
mech.holding();
|
mech.holding();
|
||||||
@@ -1277,7 +1252,7 @@ const mech = {
|
|||||||
effect: () => {
|
effect: () => {
|
||||||
// mech.fieldHarmReduction = 0.80;
|
// mech.fieldHarmReduction = 0.80;
|
||||||
mech.fieldBlockCD = 0;
|
mech.fieldBlockCD = 0;
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
mech.holding();
|
mech.holding();
|
||||||
@@ -1323,7 +1298,7 @@ const mech = {
|
|||||||
// mech.fieldMeterColor = "#0af"
|
// mech.fieldMeterColor = "#0af"
|
||||||
// mech.fieldArc = 0.3; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
// mech.fieldArc = 0.3; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
||||||
// mech.calculateFieldThreshold();
|
// mech.calculateFieldThreshold();
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
const wave = Math.sin(mech.cycle * 0.022);
|
const wave = Math.sin(mech.cycle * 0.022);
|
||||||
mech.fieldRange = 170 + 12 * wave
|
mech.fieldRange = 170 + 12 * wave
|
||||||
mech.fieldArc = 0.33 + 0.045 * wave //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
mech.fieldArc = 0.33 + 0.045 * wave //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
||||||
@@ -1370,11 +1345,11 @@ const mech = {
|
|||||||
mech.drawFieldMeter()
|
mech.drawFieldMeter()
|
||||||
|
|
||||||
if (mod.isPerfectBrake) { //cap mob speed around player
|
if (mod.isPerfectBrake) { //cap mob speed around player
|
||||||
const range = 400 + 120 * wave
|
const range = 350 + 140 * wave
|
||||||
for (let i = 0; i < mob.length; i++) {
|
for (let i = 0; i < mob.length; i++) {
|
||||||
const distance = Vector.magnitude(Vector.sub(mech.pos, mob[i].position))
|
const distance = Vector.magnitude(Vector.sub(mech.pos, mob[i].position))
|
||||||
if (distance < range) {
|
if (distance < range) {
|
||||||
const cap = mob[i].isShielded ? 8 : 4
|
const cap = mob[i].isShielded ? 8.5 : 4.5
|
||||||
if (mob[i].speed > cap && Vector.dot(mob[i].velocity, Vector.sub(mech.pos, mob[i].position)) > 0) { // if velocity is directed towards player
|
if (mob[i].speed > cap && Vector.dot(mob[i].velocity, Vector.sub(mech.pos, mob[i].position)) > 0) { // if velocity is directed towards player
|
||||||
Matter.Body.setVelocity(mob[i], Vector.mult(Vector.normalise(mob[i].velocity), cap)); //set velocity to cap, but keep the direction
|
Matter.Body.setVelocity(mob[i], Vector.mult(Vector.normalise(mob[i].velocity), cap)); //set velocity to cap, but keep the direction
|
||||||
}
|
}
|
||||||
@@ -1390,9 +1365,9 @@ const mech = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "nano-scale manufacturing",
|
name: "nano-scale manufacturing",
|
||||||
description: "use <strong class='color-f'>energy</strong> to <strong>block</strong> mobs<br>excess <strong class='color-f'>energy</strong> used to build <strong>drones</strong><br>increase <strong class='color-f'>energy</strong> regeneration by <strong>100%</strong>",
|
description: "use <strong class='color-f'>energy</strong> to <strong>block</strong> mobs<br>excess <strong class='color-f'>energy</strong> used to build <strong>drones</strong><br><strong>double</strong> your default <strong class='color-f'>energy</strong> regeneration",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
if (mech.energy > mech.maxEnergy - 0.02 && mech.fieldCDcycle < mech.cycle) {
|
if (mech.energy > mech.maxEnergy - 0.02 && mech.fieldCDcycle < mech.cycle) {
|
||||||
if (mod.isSporeField) {
|
if (mod.isSporeField) {
|
||||||
// mech.fieldCDcycle = mech.cycle + 10; // set cool down to prevent +energy from making huge numbers of drones
|
// mech.fieldCDcycle = mech.cycle + 10; // set cool down to prevent +energy from making huge numbers of drones
|
||||||
@@ -1453,7 +1428,7 @@ const mech = {
|
|||||||
mech.fieldHarmReduction = 0.6;
|
mech.fieldHarmReduction = 0.6;
|
||||||
mech.fieldDrawRadius = 0;
|
mech.fieldDrawRadius = 0;
|
||||||
|
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
mech.airSpeedLimit = 125 //5 * player.mass * player.mass
|
mech.airSpeedLimit = 125 //5 * player.mass * player.mass
|
||||||
mech.FxAir = 0.016
|
mech.FxAir = 0.016
|
||||||
mech.isFieldActive = false;
|
mech.isFieldActive = false;
|
||||||
@@ -1567,7 +1542,7 @@ const mech = {
|
|||||||
description: "use <strong class='color-f'>energy</strong> to emit short range <strong class='color-plasma'>plasma</strong><br><strong class='color-d'>damages</strong> and <strong>pushes</strong> mobs away",
|
description: "use <strong class='color-f'>energy</strong> to emit short range <strong class='color-plasma'>plasma</strong><br><strong class='color-d'>damages</strong> and <strong>pushes</strong> mobs away",
|
||||||
effect() {
|
effect() {
|
||||||
mech.fieldMeterColor = "#f0f"
|
mech.fieldMeterColor = "#f0f"
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
mech.holding();
|
mech.holding();
|
||||||
@@ -1595,7 +1570,7 @@ const mech = {
|
|||||||
y: mech.pos.y + range * Math.sin(mech.angle)
|
y: mech.pos.y + range * Math.sin(mech.angle)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const vertexCollision = function (v1, v1End, domain) {
|
const vertexCollision = function(v1, v1End, domain) {
|
||||||
for (let i = 0; i < domain.length; ++i) {
|
for (let i = 0; i < domain.length; ++i) {
|
||||||
let vertices = domain[i].vertices;
|
let vertices = domain[i].vertices;
|
||||||
const len = vertices.length - 1;
|
const len = vertices.length - 1;
|
||||||
@@ -1724,7 +1699,7 @@ const mech = {
|
|||||||
// mech.fieldMeterColor = "#000"
|
// mech.fieldMeterColor = "#000"
|
||||||
mech.fieldFire = true;
|
mech.fieldFire = true;
|
||||||
mech.isBodiesAsleep = false;
|
mech.isBodiesAsleep = false;
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
mech.wakeCheck();
|
mech.wakeCheck();
|
||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
@@ -1734,7 +1709,7 @@ const mech = {
|
|||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
mech.lookForPickUp(180);
|
mech.lookForPickUp(180);
|
||||||
|
|
||||||
const DRAIN = 0.0006
|
const DRAIN = 0.0008
|
||||||
if (mech.energy > DRAIN) {
|
if (mech.energy > DRAIN) {
|
||||||
mech.energy -= DRAIN;
|
mech.energy -= DRAIN;
|
||||||
if (mech.energy < DRAIN) {
|
if (mech.energy < DRAIN) {
|
||||||
@@ -1822,7 +1797,7 @@ const mech = {
|
|||||||
mech.fieldDrawRadius = 0
|
mech.fieldDrawRadius = 0
|
||||||
const drawRadius = 1000
|
const drawRadius = 1000
|
||||||
|
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
mech.holding();
|
mech.holding();
|
||||||
@@ -2101,7 +2076,7 @@ const mech = {
|
|||||||
mech.fieldOn = false;
|
mech.fieldOn = false;
|
||||||
mech.fieldRadius = 0;
|
mech.fieldRadius = 0;
|
||||||
mech.drop();
|
mech.drop();
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
if (input.field) {
|
if (input.field) {
|
||||||
if (mech.fieldCDcycle < mech.cycle) {
|
if (mech.fieldCDcycle < mech.cycle) {
|
||||||
const scale = 25
|
const scale = 25
|
||||||
@@ -2258,7 +2233,7 @@ const mech = {
|
|||||||
// angle: 0,
|
// angle: 0,
|
||||||
// unit:{x:0,y:0},
|
// unit:{x:0,y:0},
|
||||||
// }
|
// }
|
||||||
mech.hold = function () {
|
mech.hold = function() {
|
||||||
if (mech.hole.isOn) {
|
if (mech.hole.isOn) {
|
||||||
// draw holes
|
// draw holes
|
||||||
mech.fieldRange = 0.97 * mech.fieldRange + 0.03 * (50 + 10 * Math.sin(game.cycle * 0.025))
|
mech.fieldRange = 0.97 * mech.fieldRange + 0.03 * (50 + 10 * Math.sin(game.cycle * 0.025))
|
||||||
@@ -2461,19 +2436,11 @@ const mech = {
|
|||||||
mech.hole.unit = Vector.perp(Vector.normalise(sub))
|
mech.hole.unit = Vector.perp(Vector.normalise(sub))
|
||||||
|
|
||||||
if (mod.isWormholeDamage) {
|
if (mod.isWormholeDamage) {
|
||||||
who = Matter.Query.ray(mob, mech.pos, game.mouseInGame, 60)
|
who = Matter.Query.ray(mob, mech.pos, game.mouseInGame, 80)
|
||||||
for (let i = 0; i < who.length; i++) {
|
for (let i = 0; i < who.length; i++) {
|
||||||
if (who[i].body.alive) {
|
if (who[i].body.alive) {
|
||||||
const dmg = b.dmgScale * 6
|
mobs.statusDoT(who[i].body, 0.6, 420)
|
||||||
who[i].body.damage(dmg);
|
mobs.statusStun(who[i].body, 240)
|
||||||
who[i].body.locatePlayer();
|
|
||||||
game.drawList.push({ //add dmg to draw queue
|
|
||||||
x: who[i].body.position.x,
|
|
||||||
y: who[i].body.position.y,
|
|
||||||
radius: Math.log(2 * dmg + 1.1) * 40,
|
|
||||||
color: game.playerDmgColor,
|
|
||||||
time: game.drawTime
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
638
js/spawn.js
638
js/spawn.js
File diff suppressed because it is too large
Load Diff
61
todo.txt
61
todo.txt
@@ -1,10 +1,46 @@
|
|||||||
neutron bomb does 60% more damage
|
missile moves slightly differently
|
||||||
powerUpBoss has a shorter vision range, and accelerates slower
|
it used to slow when locked on to a target
|
||||||
custom mode has the option to disable mod, guns, and fields
|
now it slows when turning
|
||||||
several changes to community maps (by Francois 👑)
|
missiles explode when near any mob
|
||||||
|
|
||||||
|
wormhole mod: cosmic string - now stuns mobs and applies radiation damage
|
||||||
|
mod time dilation: - quadruple your default energy regeneration
|
||||||
|
|
||||||
|
added final boss level, it's still in progress so I'd love some feedback
|
||||||
|
also the game loops back to the intro level after the boss
|
||||||
|
I'll be working on the ending in the next patch, so the intro level is just a placeholder
|
||||||
|
|
||||||
************** TODO - n-gon **************
|
************** TODO - n-gon **************
|
||||||
|
|
||||||
|
final boss has elements of other bosses
|
||||||
|
laser mode
|
||||||
|
if player is on left rotate counter clockwise
|
||||||
|
if player is on right rotate clockwise
|
||||||
|
start of laser mode
|
||||||
|
push block either left or right, not away
|
||||||
|
vibrating shape
|
||||||
|
grow and shrink
|
||||||
|
oscillate elliptical deformation (not sure how)
|
||||||
|
|
||||||
|
a bot that eats ammo and converts them into rerolls
|
||||||
|
or 2 ammo power ups = 1 reroll
|
||||||
|
|
||||||
|
been getting some fps slow down after playing for a few minutes
|
||||||
|
|
||||||
|
new status effect: fear - push mob away from player for a time
|
||||||
|
|
||||||
|
new status effect - apply status effect to mobs that makes blocks attracted to them
|
||||||
|
only lasts a few cycles
|
||||||
|
|
||||||
|
in hard and why have some mobs spawn in later in the level
|
||||||
|
where
|
||||||
|
at defined points in array levelSpawns = [{x:0,y:0},{x:0,y:0}]
|
||||||
|
store the locations of mobs when the level starts to use as respawn points
|
||||||
|
remove the locations that are close to player
|
||||||
|
when?
|
||||||
|
after some mobs are dead
|
||||||
|
after the boss is killed
|
||||||
|
|
||||||
mod - explosions apply radiation damage over time
|
mod - explosions apply radiation damage over time
|
||||||
or spawn a neutron bomb with a short timer
|
or spawn a neutron bomb with a short timer
|
||||||
|
|
||||||
@@ -13,26 +49,15 @@ mod self destruct - drones explode when they die
|
|||||||
|
|
||||||
add an ending to the game
|
add an ending to the game
|
||||||
add a final boss battle level
|
add a final boss battle level
|
||||||
final boss has elements of other bosses
|
|
||||||
alternate between black hole aura and laser beams
|
|
||||||
fire seeker bullets
|
|
||||||
drop bombs
|
|
||||||
tail of shielded mobs
|
|
||||||
shield
|
|
||||||
mirror ending (if no cheats)
|
mirror ending (if no cheats)
|
||||||
level after final boss battle is the intro level, but flipped left right, with a fake player
|
level after final boss battle is the intro level, but flipped left right, with a fake player
|
||||||
damage the fake player to end the game?
|
damage the fake player to end the game
|
||||||
|
message about go outside
|
||||||
no ending (if cheats)
|
no ending (if cheats)
|
||||||
game goes on forever
|
game goes on forever
|
||||||
|
also game goes on if player attacks, the fake player
|
||||||
around level 15
|
|
||||||
game never ends if you have used cheats
|
game never ends if you have used cheats
|
||||||
|
|
||||||
new status effect - push mob away from player for a time
|
|
||||||
|
|
||||||
new status effect - apply status effect to mobs that makes blocks attracted to them
|
|
||||||
only lasts a few cycles
|
|
||||||
|
|
||||||
foam or spore bullet on dmg shrink effect
|
foam or spore bullet on dmg shrink effect
|
||||||
it might mess with the foam position of other bullets on the mob
|
it might mess with the foam position of other bullets on the mob
|
||||||
shrink when foam bullets end while attached, or shrink on collision?
|
shrink when foam bullets end while attached, or shrink on collision?
|
||||||
|
|||||||
Reference in New Issue
Block a user