console style
updated in game console style and all messages to match real game commands new names inline with lore, mod -> tech, game -> simulation this is probably going to cause many minor bugs, so let me know what you find new reroll display in power up selection tech: rocket-propelled now works with all grenade tech
This commit is contained in:
230
js/spawn.js
230
js/spawn.js
@@ -28,7 +28,7 @@ const spawn = {
|
||||
spawn.pickList.push(spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)]);
|
||||
},
|
||||
spawnChance(chance) {
|
||||
return Math.random() < chance + 0.07 * game.difficulty && mob.length < -1 + 16 * Math.log10(game.difficulty + 1)
|
||||
return Math.random() < chance + 0.07 * simulation.difficulty && mob.length < -1 + 16 * Math.log10(simulation.difficulty + 1)
|
||||
},
|
||||
randomMob(x, y, chance = 1) {
|
||||
if (spawn.spawnChance(chance) || chance === Infinity) {
|
||||
@@ -37,7 +37,7 @@ const spawn = {
|
||||
}
|
||||
},
|
||||
randomSmallMob(x, y,
|
||||
num = Math.max(Math.min(Math.round(Math.random() * game.difficulty * 0.2), 4), 0),
|
||||
num = Math.max(Math.min(Math.round(Math.random() * simulation.difficulty * 0.2), 4), 0),
|
||||
size = 16 + Math.ceil(Math.random() * 15),
|
||||
chance = 1) {
|
||||
if (spawn.spawnChance(chance)) {
|
||||
@@ -48,7 +48,7 @@ const spawn = {
|
||||
}
|
||||
},
|
||||
randomBoss(x, y, chance = 1) {
|
||||
if (spawn.spawnChance(chance) && game.difficulty > 2 || chance == Infinity) {
|
||||
if (spawn.spawnChance(chance) && simulation.difficulty > 2 || chance == Infinity) {
|
||||
//choose from the possible picklist
|
||||
let pick = this.pickList[Math.floor(Math.random() * this.pickList.length)];
|
||||
//is the pick able to be a boss?
|
||||
@@ -102,7 +102,7 @@ const spawn = {
|
||||
level.exit.x = 5500;
|
||||
level.exit.y = -330;
|
||||
//ramp up damage
|
||||
for (let i = 0; i < 4; i++) level.difficultyIncrease(game.difficultyMode)
|
||||
for (let i = 0; i < 4; i++) level.difficultyIncrease(simulation.difficultyMode)
|
||||
|
||||
|
||||
//pull in particles
|
||||
@@ -121,7 +121,7 @@ const spawn = {
|
||||
|
||||
//draw stuff
|
||||
for (let i = 0, len = 22; i < len; i++) {
|
||||
game.drawList.push({ //add dmg to draw queue
|
||||
simulation.drawList.push({ //add dmg to draw queue
|
||||
x: this.position.x,
|
||||
y: this.position.y,
|
||||
radius: (i + 1) * 150,
|
||||
@@ -219,9 +219,9 @@ const spawn = {
|
||||
});
|
||||
}
|
||||
|
||||
if (game.difficulty > 60) {
|
||||
if (simulation.difficulty > 60) {
|
||||
spawn.randomLevelBoss(3000, -1100)
|
||||
if (game.difficulty > 100) {
|
||||
if (simulation.difficulty > 100) {
|
||||
spawn.randomLevelBoss(3000, -1300)
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ const spawn = {
|
||||
me.eventHorizonCycleRate = 4 * Math.PI / me.endCycle
|
||||
me.modeSuck = function() {
|
||||
//eventHorizon waves in and out
|
||||
const eventHorizon = this.eventHorizon * (1 - 0.25 * Math.cos(game.cycle * this.eventHorizonCycleRate)) //0.014
|
||||
const eventHorizon = this.eventHorizon * (1 - 0.25 * Math.cos(simulation.cycle * this.eventHorizonCycleRate)) //0.014
|
||||
//draw darkness
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.position.x, this.position.y, eventHorizon * 0.2, 0, 2 * Math.PI);
|
||||
@@ -257,7 +257,7 @@ const spawn = {
|
||||
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
|
||||
if (mech.energy > 0) mech.energy -= 0.01
|
||||
if (mech.energy < 0.15) {
|
||||
mech.damage(0.0004 * game.dmgScale);
|
||||
mech.damage(0.0004 * simulation.dmgScale);
|
||||
}
|
||||
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
|
||||
player.force.x -= 0.0017 * Math.cos(angle) * player.mass * (mech.onGround ? 1.7 : 1);
|
||||
@@ -296,7 +296,7 @@ const spawn = {
|
||||
}
|
||||
if (this.cycle < 240) { //damage scales up over 2 seconds to give player time to move
|
||||
const scale = this.cycle / 240
|
||||
const dmg = (this.cycle < 120) ? 0 : 0.14 * game.dmgScale * scale
|
||||
const dmg = (this.cycle < 120) ? 0 : 0.14 * simulation.dmgScale * scale
|
||||
ctx.beginPath();
|
||||
this.laser(this.vertices[0], this.angle + Math.PI / 6, dmg);
|
||||
this.laser(this.vertices[1], this.angle + 3 * Math.PI / 6, dmg);
|
||||
@@ -329,13 +329,13 @@ const spawn = {
|
||||
ctx.strokeStyle = "rgba(80,0,255,0.07)";
|
||||
ctx.stroke(); // Draw it
|
||||
}
|
||||
me.laser = function(where, angle, dmg = 0.14 * game.dmgScale) {
|
||||
me.laser = function(where, angle, dmg = 0.14 * simulation.dmgScale) {
|
||||
const vertexCollision = function(v1, v1End, domain) {
|
||||
for (let i = 0; i < domain.length; ++i) {
|
||||
let vertices = domain[i].vertices;
|
||||
const len = vertices.length - 1;
|
||||
for (let j = 0; j < len; j++) {
|
||||
results = game.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]);
|
||||
results = simulation.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]);
|
||||
if (results.onLine1 && results.onLine2) {
|
||||
const dx = v1.x - results.x;
|
||||
const dy = v1.y - results.y;
|
||||
@@ -350,7 +350,7 @@ const spawn = {
|
||||
};
|
||||
}
|
||||
}
|
||||
results = game.checkLineIntersection(v1, v1End, vertices[0], vertices[len]);
|
||||
results = simulation.checkLineIntersection(v1, v1End, vertices[0], vertices[len]);
|
||||
if (results.onLine1 && results.onLine2) {
|
||||
const dx = v1.x - results.x;
|
||||
const dy = v1.y - results.y;
|
||||
@@ -385,9 +385,9 @@ const spawn = {
|
||||
vertexCollision(where, look, body);
|
||||
if (!mech.isCloak) vertexCollision(where, look, [player]);
|
||||
if (best.who && best.who === player && mech.immuneCycle < mech.cycle) {
|
||||
mech.immuneCycle = mech.cycle + 60 + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||
mech.immuneCycle = mech.cycle + 60 + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||
mech.damage(dmg);
|
||||
game.drawList.push({ //add dmg to draw queue
|
||||
simulation.drawList.push({ //add dmg to draw queue
|
||||
x: best.x,
|
||||
y: best.y,
|
||||
radius: dmg * 1500,
|
||||
@@ -412,7 +412,7 @@ const spawn = {
|
||||
mobs.spawn(x, y, 4, radius, "#777");
|
||||
let me = mob[mob.length - 1];
|
||||
me.g = 0.00015; //required if using 'gravity'
|
||||
me.accelMag = 0.0008 * game.accelScale;
|
||||
me.accelMag = 0.0008 * simulation.accelScale;
|
||||
me.groupingRangeMax = 250000 + Math.random() * 100000;
|
||||
me.groupingRangeMin = (radius * 8) * (radius * 8);
|
||||
me.groupingStrength = 0.0005
|
||||
@@ -454,7 +454,7 @@ const spawn = {
|
||||
mobs.spawn(x, y, 8, radius, "#9ccdc6");
|
||||
let me = mob[mob.length - 1];
|
||||
// console.log(`mass=${me.mass}, radius = ${radius}`)
|
||||
me.accelMag = 0.0005 * game.accelScale;
|
||||
me.accelMag = 0.0005 * simulation.accelScale;
|
||||
me.memory = 60;
|
||||
me.seeAtDistance2 = 1400000 //1200 vision range
|
||||
Matter.Body.setDensity(me, 0.0005) // normal density is 0.001 // this reduces life by half and decreases knockback
|
||||
@@ -475,7 +475,7 @@ const spawn = {
|
||||
let me = mob[mob.length - 1];
|
||||
me.isBoss = true;
|
||||
me.isCell = true;
|
||||
me.accelMag = 0.00015 * game.accelScale;
|
||||
me.accelMag = 0.00015 * simulation.accelScale;
|
||||
me.memory = 40;
|
||||
me.isVerticesChange = true
|
||||
me.frictionAir = 0.012
|
||||
@@ -511,7 +511,7 @@ const spawn = {
|
||||
Matter.Body.scale(this, scale, scale);
|
||||
this.radius = Math.sqrt(this.mass * k / Math.PI)
|
||||
}
|
||||
if (!(game.cycle % this.seePlayerFreq)) { //move away from other mobs
|
||||
if (!(simulation.cycle % this.seePlayerFreq)) { //move away from other mobs
|
||||
const repelRange = 200
|
||||
const attractRange = 800
|
||||
for (let i = 0, len = mob.length; i < len; i++) {
|
||||
@@ -548,7 +548,7 @@ const spawn = {
|
||||
me.isBoss = true;
|
||||
me.frictionAir = 0.01
|
||||
me.seeAtDistance2 = 1000000;
|
||||
me.accelMag = 0.0005 * game.accelScale;
|
||||
me.accelMag = 0.0005 * simulation.accelScale;
|
||||
Matter.Body.setDensity(me, 0.0006); //normal is 0.001
|
||||
me.collisionFilter.mask = cat.bullet | cat.player
|
||||
me.memory = Infinity;
|
||||
@@ -583,7 +583,7 @@ const spawn = {
|
||||
}
|
||||
};
|
||||
me.do = function() {
|
||||
this.stroke = `hsl(0,0%,${80+25*Math.sin(game.cycle*0.01)}%)`
|
||||
this.stroke = `hsl(0,0%,${80+25*Math.sin(simulation.cycle*0.01)}%)`
|
||||
|
||||
//steal all power ups
|
||||
for (let i = 0; i < Math.min(powerUp.length, this.vertices.length); i++) {
|
||||
@@ -606,7 +606,7 @@ const spawn = {
|
||||
// Matter.Body.setDensity(me, 0.0007); //extra dense //normal is 0.001 //makes effective life much lower
|
||||
me.friction = 0;
|
||||
me.frictionAir = 0;
|
||||
me.accelMag = 0.001 * Math.sqrt(game.accelScale);
|
||||
me.accelMag = 0.001 * Math.sqrt(simulation.accelScale);
|
||||
me.g = me.accelMag * 0.6; //required if using 'gravity'
|
||||
me.memory = 50;
|
||||
spawn.shield(me, x, y);
|
||||
@@ -622,7 +622,7 @@ const spawn = {
|
||||
let me = mob[mob.length - 1];
|
||||
me.isVerticesChange = true
|
||||
me.big = false; //required for grow
|
||||
me.accelMag = 0.00045 * game.accelScale;
|
||||
me.accelMag = 0.00045 * simulation.accelScale;
|
||||
me.collisionFilter.mask = cat.map | cat.body | cat.bullet | cat.player //can't touch other mobs
|
||||
// me.onDeath = function () { //helps collisions functions work better after vertex have been changed
|
||||
// this.vertices = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices))
|
||||
@@ -641,7 +641,7 @@ const spawn = {
|
||||
me.frictionAir = 0.006;
|
||||
me.lookTorque = 0.0000008; //controls spin while looking for player
|
||||
me.g = 0.0002; //required if using 'gravity'
|
||||
me.seePlayerFreq = Math.round((40 + 25 * Math.random()) * game.lookFreqScale);
|
||||
me.seePlayerFreq = Math.round((40 + 25 * Math.random()) * simulation.lookFreqScale);
|
||||
const springStiffness = 0.00014;
|
||||
const springDampening = 0.0005;
|
||||
|
||||
@@ -695,17 +695,17 @@ const spawn = {
|
||||
me.g = 0.0017; //required if using 'gravity'
|
||||
me.frictionAir = 0.01;
|
||||
me.restitution = 0;
|
||||
me.delay = 120 * game.CDScale;
|
||||
me.delay = 120 * simulation.CDScale;
|
||||
me.randomHopFrequency = 200 + Math.floor(Math.random() * 150);
|
||||
me.randomHopCD = game.cycle + me.randomHopFrequency;
|
||||
me.randomHopCD = simulation.cycle + me.randomHopFrequency;
|
||||
spawn.shield(me, x, y);
|
||||
me.do = function() {
|
||||
this.gravity();
|
||||
this.seePlayerCheck();
|
||||
this.checkStatus();
|
||||
if (this.seePlayer.recall) {
|
||||
if (this.cd < game.cycle && (Matter.Query.collides(this, map).length || Matter.Query.collides(this, body).length)) {
|
||||
this.cd = game.cycle + this.delay;
|
||||
if (this.cd < simulation.cycle && (Matter.Query.collides(this, map).length || Matter.Query.collides(this, body).length)) {
|
||||
this.cd = simulation.cycle + this.delay;
|
||||
const forceMag = (this.accelMag + this.accelMag * Math.random()) * this.mass;
|
||||
const angle = Math.atan2(this.seePlayer.position.y - this.position.y, this.seePlayer.position.x - this.position.x);
|
||||
this.force.x += forceMag * Math.cos(angle);
|
||||
@@ -713,8 +713,8 @@ const spawn = {
|
||||
}
|
||||
} else {
|
||||
//randomly hob if not aware of player
|
||||
if (this.randomHopCD < game.cycle && (Matter.Query.collides(this, map).length || Matter.Query.collides(this, body).length)) {
|
||||
this.randomHopCD = game.cycle + this.randomHopFrequency;
|
||||
if (this.randomHopCD < simulation.cycle && (Matter.Query.collides(this, map).length || Matter.Query.collides(this, body).length)) {
|
||||
this.randomHopCD = simulation.cycle + this.randomHopFrequency;
|
||||
//slowly change randomHopFrequency after each hop
|
||||
this.randomHopFrequency = Math.max(100, this.randomHopFrequency + (0.5 - Math.random()) * 200);
|
||||
const forceMag = (this.accelMag + this.accelMag * Math.random()) * this.mass * (0.1 + Math.random() * 0.3);
|
||||
@@ -742,9 +742,9 @@ const spawn = {
|
||||
me.look = function() {
|
||||
this.seePlayerByLookingAt();
|
||||
this.checkStatus();
|
||||
if (this.seePlayer.recall && this.cd < game.cycle) {
|
||||
if (this.seePlayer.recall && this.cd < simulation.cycle) {
|
||||
this.burstDir = Vector.normalise(Vector.sub(this.seePlayer.position, this.position));
|
||||
this.cd = game.cycle + 40;
|
||||
this.cd = simulation.cycle + 40;
|
||||
this.do = this.spin
|
||||
}
|
||||
}
|
||||
@@ -766,9 +766,9 @@ const spawn = {
|
||||
ctx.lineTo(dir.x, dir.y);
|
||||
ctx.stroke();
|
||||
ctx.setLineDash([]);
|
||||
if (this.cd < game.cycle) {
|
||||
if (this.cd < simulation.cycle) {
|
||||
this.fill = this.rememberFill;
|
||||
this.cd = game.cycle + 180 * game.CDScale
|
||||
this.cd = simulation.cycle + 180 * simulation.CDScale
|
||||
this.do = this.look
|
||||
this.force = Vector.mult(this.burstDir, this.mass * 0.25);
|
||||
}
|
||||
@@ -781,7 +781,7 @@ const spawn = {
|
||||
me.stroke = "transparent"; //used for drawSneaker
|
||||
me.eventHorizon = radius * 23; //required for blackhole
|
||||
me.seeAtDistance2 = (me.eventHorizon + 400) * (me.eventHorizon + 400); //vision limit is event horizon
|
||||
me.accelMag = 0.00009 * game.accelScale;
|
||||
me.accelMag = 0.00009 * simulation.accelScale;
|
||||
me.frictionAir = 0.025;
|
||||
me.collisionFilter.mask = cat.player | cat.bullet
|
||||
me.memory = Infinity;
|
||||
@@ -795,7 +795,7 @@ const spawn = {
|
||||
});
|
||||
}
|
||||
// this.seePlayerCheckByDistance()
|
||||
if (!(game.cycle % this.seePlayerFreq)) {
|
||||
if (!(simulation.cycle % this.seePlayerFreq)) {
|
||||
if (this.distanceToPlayer2() < this.seeAtDistance2) { //&& !mech.isCloak ignore cloak for black holes
|
||||
this.locatePlayer();
|
||||
if (!this.seePlayer.yes) this.seePlayer.yes = true;
|
||||
@@ -806,7 +806,7 @@ const spawn = {
|
||||
this.checkStatus();
|
||||
if (this.seePlayer.recall) {
|
||||
//eventHorizon waves in and out
|
||||
const eventHorizon = this.eventHorizon * (0.93 + 0.17 * Math.sin(game.cycle * 0.011))
|
||||
const eventHorizon = this.eventHorizon * (0.93 + 0.17 * Math.sin(simulation.cycle * 0.011))
|
||||
|
||||
//accelerate towards the player
|
||||
const forceMag = this.accelMag * this.mass;
|
||||
@@ -832,7 +832,7 @@ const spawn = {
|
||||
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
|
||||
if (mech.energy > 0) mech.energy -= 0.004
|
||||
if (mech.energy < 0.1) {
|
||||
mech.damage(0.00015 * game.dmgScale);
|
||||
mech.damage(0.00015 * simulation.dmgScale);
|
||||
}
|
||||
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
|
||||
player.force.x -= 0.00125 * player.mass * Math.cos(angle) * (mech.onGround ? 1.8 : 1);
|
||||
@@ -859,7 +859,7 @@ const spawn = {
|
||||
me.stroke = "transparent"; //used for drawSneaker
|
||||
me.eventHorizon = 1100; //required for black hole
|
||||
me.seeAtDistance2 = (me.eventHorizon + 1200) * (me.eventHorizon + 1200); //vision limit is event horizon
|
||||
me.accelMag = 0.00003 * game.accelScale;
|
||||
me.accelMag = 0.00003 * simulation.accelScale;
|
||||
me.collisionFilter.mask = cat.player | cat.bullet
|
||||
// me.frictionAir = 0.005;
|
||||
me.memory = 1600;
|
||||
@@ -867,7 +867,7 @@ const spawn = {
|
||||
me.onDeath = function() {
|
||||
//applying forces to player doesn't seem to work inside this method, not sure why
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
if (game.difficulty > 5) {
|
||||
if (simulation.difficulty > 5) {
|
||||
//teleport everything to center
|
||||
function toMe(who, where, range) {
|
||||
for (let i = 0, len = who.length; i < len; i++) {
|
||||
@@ -891,7 +891,7 @@ const spawn = {
|
||||
y: this.velocity.y * 0.95
|
||||
});
|
||||
}
|
||||
if (!(game.cycle % this.seePlayerFreq)) {
|
||||
if (!(simulation.cycle % this.seePlayerFreq)) {
|
||||
if (this.distanceToPlayer2() < this.seeAtDistance2) { //&& !mech.isCloak ignore cloak for black holes
|
||||
this.locatePlayer();
|
||||
if (!this.seePlayer.yes) this.seePlayer.yes = true;
|
||||
@@ -910,7 +910,7 @@ const spawn = {
|
||||
this.force.y += forceMag * dy / mag;
|
||||
|
||||
//eventHorizon waves in and out
|
||||
const eventHorizon = this.eventHorizon * (1 + 0.2 * Math.sin(game.cycle * 0.008))
|
||||
const eventHorizon = this.eventHorizon * (1 + 0.2 * Math.sin(simulation.cycle * 0.008))
|
||||
// zoom camera in and out with the event horizon
|
||||
|
||||
//draw darkness
|
||||
@@ -938,7 +938,7 @@ const spawn = {
|
||||
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
|
||||
if (mech.energy > 0) mech.energy -= 0.006
|
||||
if (mech.energy < 0.1) {
|
||||
mech.damage(0.0002 * game.dmgScale);
|
||||
mech.damage(0.0002 * simulation.dmgScale);
|
||||
}
|
||||
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
|
||||
player.force.x -= 0.0013 * Math.cos(angle) * player.mass * (mech.onGround ? 1.7 : 1);
|
||||
@@ -970,7 +970,7 @@ const spawn = {
|
||||
me.frictionAir = 0.0065;
|
||||
me.lookTorque = 0.0000008; //controls spin while looking for player
|
||||
me.g = 0.0002; //required if using 'gravity'
|
||||
me.seePlayerFreq = Math.round((30 + 20 * Math.random()) * game.lookFreqScale);
|
||||
me.seePlayerFreq = Math.round((30 + 20 * Math.random()) * simulation.lookFreqScale);
|
||||
const springStiffness = 0.00014;
|
||||
const springDampening = 0.0005;
|
||||
|
||||
@@ -1053,11 +1053,11 @@ const spawn = {
|
||||
me.timeSkipLastCycle = 0
|
||||
me.eventHorizon = 1800; //required for black hole
|
||||
me.seeAtDistance2 = (me.eventHorizon + 2000) * (me.eventHorizon + 2000); //vision limit is event horizon + 2000
|
||||
me.accelMag = 0.0004 * game.accelScale;
|
||||
me.accelMag = 0.0004 * simulation.accelScale;
|
||||
// me.frictionAir = 0.005;
|
||||
// me.memory = 1600;
|
||||
// Matter.Body.setDensity(me, 0.02); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
Matter.Body.setDensity(me, 0.0015 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
Matter.Body.setDensity(me, 0.0015 + 0.0005 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
spawn.shield(me, x, y, 1);
|
||||
|
||||
|
||||
@@ -1076,12 +1076,12 @@ const spawn = {
|
||||
this.seePlayerCheck();
|
||||
this.checkStatus();
|
||||
this.attraction()
|
||||
if (!game.isTimeSkipping) {
|
||||
if (!simulation.isTimeSkipping) {
|
||||
const compress = 1
|
||||
if (this.timeSkipLastCycle < game.cycle - compress &&
|
||||
if (this.timeSkipLastCycle < simulation.cycle - compress &&
|
||||
Vector.magnitude(Vector.sub(this.position, player.position)) < this.eventHorizon) {
|
||||
this.timeSkipLastCycle = game.cycle
|
||||
game.timeSkip(compress)
|
||||
this.timeSkipLastCycle = simulation.cycle
|
||||
simulation.timeSkip(compress)
|
||||
|
||||
this.fill = `rgba(0,0,0,${0.4+0.6*Math.random()})`
|
||||
this.stroke = "#014"
|
||||
@@ -1132,7 +1132,7 @@ const spawn = {
|
||||
let me = mob[mob.length - 1];
|
||||
me.repulsionRange = 73000; //squared
|
||||
me.laserRange = 370;
|
||||
me.accelMag = 0.0005 * game.accelScale;
|
||||
me.accelMag = 0.0005 * simulation.accelScale;
|
||||
me.frictionStatic = 0;
|
||||
me.friction = 0;
|
||||
spawn.shield(me, x, y);
|
||||
@@ -1153,7 +1153,7 @@ const spawn = {
|
||||
me.restitution = 0;
|
||||
me.laserPos = me.position; //required for laserTracking
|
||||
me.repulsionRange = 1200000; //squared
|
||||
me.accelMag = 0.00009 * game.accelScale;
|
||||
me.accelMag = 0.00009 * simulation.accelScale;
|
||||
me.frictionStatic = 0;
|
||||
me.friction = 0;
|
||||
me.onDamage = function() {
|
||||
@@ -1216,8 +1216,8 @@ const spawn = {
|
||||
me.isBoss = true;
|
||||
me.vertices = Matter.Vertices.rotate(me.vertices, Math.PI, me.position); //make the pointy side of triangle the front
|
||||
Matter.Body.rotate(me, Math.random() * Math.PI * 2);
|
||||
me.accelMag = 0.0002 * Math.sqrt(game.accelScale);
|
||||
me.seePlayerFreq = Math.floor(30 * game.lookFreqScale);
|
||||
me.accelMag = 0.0002 * Math.sqrt(simulation.accelScale);
|
||||
me.seePlayerFreq = Math.floor(30 * simulation.lookFreqScale);
|
||||
me.memory = 420;
|
||||
me.restitution = 1;
|
||||
me.frictionAir = 0.01;
|
||||
@@ -1247,7 +1247,7 @@ const spawn = {
|
||||
|
||||
if (this.seePlayer.recall) {
|
||||
//set direction to turn to fire
|
||||
if (!(game.cycle % this.seePlayerFreq)) {
|
||||
if (!(simulation.cycle % this.seePlayerFreq)) {
|
||||
this.fireDir = Vector.normalise(Vector.sub(this.seePlayer.position, this.position));
|
||||
// this.fireDir.y -= Math.abs(this.seePlayer.position.x - this.position.x) / 1600; //gives the bullet an arc
|
||||
}
|
||||
@@ -1272,7 +1272,7 @@ const spawn = {
|
||||
let vertices = domain[i].vertices;
|
||||
const len = vertices.length - 1;
|
||||
for (let j = 0; j < len; j++) {
|
||||
results = game.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]);
|
||||
results = simulation.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]);
|
||||
if (results.onLine1 && results.onLine2) {
|
||||
const dx = v1.x - results.x;
|
||||
const dy = v1.y - results.y;
|
||||
@@ -1289,7 +1289,7 @@ const spawn = {
|
||||
}
|
||||
}
|
||||
}
|
||||
results = game.checkLineIntersection(v1, v1End, vertices[0], vertices[len]);
|
||||
results = simulation.checkLineIntersection(v1, v1End, vertices[0], vertices[len]);
|
||||
if (results.onLine1 && results.onLine2) {
|
||||
const dx = v1.x - results.x;
|
||||
const dy = v1.y - results.y;
|
||||
@@ -1327,7 +1327,7 @@ const spawn = {
|
||||
// hitting player
|
||||
if (best.who === player) {
|
||||
if (mech.immuneCycle < mech.cycle) {
|
||||
const dmg = 0.001 * game.dmgScale;
|
||||
const dmg = 0.001 * simulation.dmgScale;
|
||||
mech.damage(dmg);
|
||||
//draw damage
|
||||
ctx.fillStyle = color;
|
||||
@@ -1356,7 +1356,7 @@ const spawn = {
|
||||
let me = mob[mob.length - 1];
|
||||
me.vertices = Matter.Vertices.rotate(me.vertices, Math.PI, me.position); //make the pointy side of triangle the front
|
||||
Matter.Body.rotate(me, Math.random() * Math.PI * 2);
|
||||
me.accelMag = 0.00007 * game.accelScale;
|
||||
me.accelMag = 0.00007 * simulation.accelScale;
|
||||
me.onHit = function() {
|
||||
//run this function on hitting player
|
||||
this.explode();
|
||||
@@ -1384,7 +1384,7 @@ const spawn = {
|
||||
me.onDeath = function() {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
};
|
||||
me.rotateVelocity = Math.min(0.0045, 0.0015 * game.accelScale * game.accelScale) * (level.levelsCleared > 8 ? 1 : -1)
|
||||
me.rotateVelocity = Math.min(0.0045, 0.0015 * simulation.accelScale * simulation.accelScale) * (level.levelsCleared > 8 ? 1 : -1)
|
||||
me.do = function() {
|
||||
this.fill = '#' + Math.random().toString(16).substr(-6); //flash colors
|
||||
this.checkStatus();
|
||||
@@ -1433,7 +1433,7 @@ const spawn = {
|
||||
let vertices = domain[i].vertices;
|
||||
const len = vertices.length - 1;
|
||||
for (let j = 0; j < len; j++) {
|
||||
results = game.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]);
|
||||
results = simulation.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]);
|
||||
if (results.onLine1 && results.onLine2) {
|
||||
const dx = v1.x - results.x;
|
||||
const dy = v1.y - results.y;
|
||||
@@ -1448,7 +1448,7 @@ const spawn = {
|
||||
};
|
||||
}
|
||||
}
|
||||
results = game.checkLineIntersection(v1, v1End, vertices[0], vertices[len]);
|
||||
results = simulation.checkLineIntersection(v1, v1End, vertices[0], vertices[len]);
|
||||
if (results.onLine1 && results.onLine2) {
|
||||
const dx = v1.x - results.x;
|
||||
const dy = v1.y - results.y;
|
||||
@@ -1483,10 +1483,10 @@ const spawn = {
|
||||
vertexCollision(where, look, body);
|
||||
if (!mech.isCloak) vertexCollision(where, look, [player]);
|
||||
if (best.who && best.who === player && mech.immuneCycle < mech.cycle) {
|
||||
mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||
const dmg = 0.14 * game.dmgScale;
|
||||
mech.immuneCycle = mech.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||
const dmg = 0.14 * simulation.dmgScale;
|
||||
mech.damage(dmg);
|
||||
game.drawList.push({ //add dmg to draw queue
|
||||
simulation.drawList.push({ //add dmg to draw queue
|
||||
x: best.x,
|
||||
y: best.y,
|
||||
radius: dmg * 1500,
|
||||
@@ -1505,9 +1505,9 @@ const spawn = {
|
||||
mobs.spawn(x, y, 6, radius, "rgb(220,50,205)"); //can't have sides above 6 or collision events don't work (probably because of a convex problem)
|
||||
let me = mob[mob.length - 1];
|
||||
me.isVerticesChange = true
|
||||
me.accelMag = 0.0006 * game.accelScale;
|
||||
me.accelMag = 0.0006 * simulation.accelScale;
|
||||
// me.g = 0.0002; //required if using 'gravity'
|
||||
me.delay = 360 * game.CDScale;
|
||||
me.delay = 360 * simulation.CDScale;
|
||||
me.spikeVertex = 0;
|
||||
me.spikeLength = 0;
|
||||
me.isSpikeGrowing = false;
|
||||
@@ -1582,20 +1582,20 @@ const spawn = {
|
||||
striker(x, y, radius = 14 + Math.ceil(Math.random() * 25)) {
|
||||
mobs.spawn(x, y, 5, radius, "rgb(221,102,119)");
|
||||
let me = mob[mob.length - 1];
|
||||
me.accelMag = 0.00034 * game.accelScale;
|
||||
me.accelMag = 0.00034 * simulation.accelScale;
|
||||
me.g = 0.00015; //required if using 'gravity'
|
||||
me.frictionStatic = 0;
|
||||
me.friction = 0;
|
||||
me.delay = 90 * game.CDScale;
|
||||
me.delay = 90 * simulation.CDScale;
|
||||
me.cd = Infinity;
|
||||
Matter.Body.rotate(me, Math.PI * 0.1);
|
||||
spawn.shield(me, x, y);
|
||||
me.onDamage = function() {
|
||||
this.cd = game.cycle + this.delay;
|
||||
this.cd = simulation.cycle + this.delay;
|
||||
};
|
||||
me.do = function() {
|
||||
this.gravity();
|
||||
if (!(game.cycle % this.seePlayerFreq)) { // this.seePlayerCheck(); from mobs
|
||||
if (!(simulation.cycle % this.seePlayerFreq)) { // this.seePlayerCheck(); from mobs
|
||||
if (
|
||||
this.distanceToPlayer2() < this.seeAtDistance2 &&
|
||||
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
|
||||
@@ -1603,7 +1603,7 @@ const spawn = {
|
||||
!mech.isCloak
|
||||
) {
|
||||
this.foundPlayer();
|
||||
if (this.cd === Infinity) this.cd = game.cycle + this.delay * 0.7;
|
||||
if (this.cd === Infinity) this.cd = simulation.cycle + this.delay * 0.7;
|
||||
} else if (this.seePlayer.recall) {
|
||||
this.lostPlayer();
|
||||
this.cd = Infinity
|
||||
@@ -1611,11 +1611,11 @@ const spawn = {
|
||||
}
|
||||
this.checkStatus();
|
||||
this.attraction();
|
||||
if (this.cd < game.cycle) {
|
||||
if (this.cd < simulation.cycle) {
|
||||
if (this.seePlayer.recall) {
|
||||
const dist = Vector.sub(this.seePlayer.position, this.position);
|
||||
const distMag = Vector.magnitude(dist);
|
||||
this.cd = game.cycle + this.delay;
|
||||
this.cd = simulation.cycle + this.delay;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(this.position.x, this.position.y);
|
||||
if (distMag < 400) {
|
||||
@@ -1639,7 +1639,7 @@ const spawn = {
|
||||
let me;
|
||||
mobs.spawn(x, y, 5, radius, "transparent");
|
||||
me = mob[mob.length - 1];
|
||||
me.accelMag = 0.0007 * game.accelScale;
|
||||
me.accelMag = 0.0007 * simulation.accelScale;
|
||||
me.g = 0.0002; //required if using 'gravity'
|
||||
me.stroke = "transparent"; //used for drawSneaker
|
||||
me.alpha = 1; //used in drawSneaker
|
||||
@@ -1690,7 +1690,7 @@ const spawn = {
|
||||
mobs.spawn(x, y, 7, radius, "transparent");
|
||||
me = mob[mob.length - 1];
|
||||
me.seeAtDistance2 = 300000;
|
||||
me.accelMag = 0.00012 * game.accelScale;
|
||||
me.accelMag = 0.00012 * simulation.accelScale;
|
||||
if (map.length) me.searchTarget = map[Math.floor(Math.random() * (map.length - 1))].position; //required for search
|
||||
Matter.Body.setDensity(me, 0.00065); //normal is 0.001 //makes effective life much lower
|
||||
me.stroke = "transparent"; //used for drawGhost
|
||||
@@ -1753,7 +1753,7 @@ const spawn = {
|
||||
// me.blinkLength = 150 + Math.round(Math.random() * 200); //required for blink
|
||||
// me.isStatic = true;
|
||||
// me.memory = 360;
|
||||
// me.seePlayerFreq = Math.round((40 + 30 * Math.random()) * game.lookFreqScale);
|
||||
// me.seePlayerFreq = Math.round((40 + 30 * Math.random()) * simulation.lookFreqScale);
|
||||
// // me.isBig = false;
|
||||
// // me.scaleMag = Math.max(5 - me.mass, 1.75);
|
||||
// me.onDeath = function () {
|
||||
@@ -1763,23 +1763,23 @@ const spawn = {
|
||||
// // }
|
||||
// };
|
||||
// me.onHit = function () {
|
||||
// game.timeSkip(120)
|
||||
// simulation.timeSkip(120)
|
||||
// };
|
||||
// me.do = function () {
|
||||
// this.seePlayerCheck();
|
||||
// this.blink();
|
||||
// //strike by expanding
|
||||
// // if (this.isBig) {
|
||||
// // if (this.cd - this.delay + 15 < game.cycle) {
|
||||
// // if (this.cd - this.delay + 15 < simulation.cycle) {
|
||||
// // Matter.Body.scale(this, 1 / this.scaleMag, 1 / this.scaleMag);
|
||||
// // this.isBig = false;
|
||||
// // }
|
||||
// // } else
|
||||
// if (this.seePlayer.yes && this.cd < game.cycle) {
|
||||
// if (this.seePlayer.yes && this.cd < simulation.cycle) {
|
||||
// const dist = Vector.sub(this.seePlayer.position, this.position);
|
||||
// const distMag2 = Vector.magnitudeSquared(dist);
|
||||
// if (distMag2 < 80000) {
|
||||
// this.cd = game.cycle + this.delay;
|
||||
// this.cd = simulation.cycle + this.delay;
|
||||
|
||||
// // Matter.Body.scale(this, this.scaleMag, this.scaleMag);
|
||||
// // this.isBig = true;
|
||||
@@ -1792,15 +1792,15 @@ const spawn = {
|
||||
mobs.spawn(x, y, 3, radius, "transparent");
|
||||
let me = mob[mob.length - 1];
|
||||
me.isBoss = true;
|
||||
Matter.Body.setDensity(me, 0.0014 + 0.0003 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
Matter.Body.setDensity(me, 0.0014 + 0.0003 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
|
||||
me.stroke = "rgba(255,0,200)"; //used for drawGhost
|
||||
me.seeAtDistance2 = 1500000;
|
||||
me.fireFreq = Math.floor(120 * game.CDScale);
|
||||
me.fireFreq = Math.floor(120 * simulation.CDScale);
|
||||
me.searchTarget = map[Math.floor(Math.random() * (map.length - 1))].position; //required for search
|
||||
me.hoverElevation = 460 + (Math.random() - 0.5) * 200; //squared
|
||||
me.hoverXOff = (Math.random() - 0.5) * 100;
|
||||
me.accelMag = Math.floor(10 * (Math.random() + 4.5)) * 0.00001 * game.accelScale;
|
||||
me.accelMag = Math.floor(10 * (Math.random() + 4.5)) * 0.00001 * simulation.accelScale;
|
||||
me.g = 0.0002; //required if using 'gravity' // gravity called in hoverOverPlayer
|
||||
me.frictionStatic = 0;
|
||||
me.friction = 0;
|
||||
@@ -1834,7 +1834,7 @@ const spawn = {
|
||||
me.fireFreq = 0.007 + Math.random() * 0.005;
|
||||
me.noseLength = 0;
|
||||
me.fireAngle = 0;
|
||||
me.accelMag = 0.0005 * game.accelScale;
|
||||
me.accelMag = 0.0005 * simulation.accelScale;
|
||||
me.frictionStatic = 0;
|
||||
me.friction = 0;
|
||||
me.frictionAir = 0.05;
|
||||
@@ -1867,14 +1867,14 @@ const spawn = {
|
||||
me.fireFreq = 0.025;
|
||||
me.noseLength = 0;
|
||||
me.fireAngle = 0;
|
||||
me.accelMag = 0.005 * game.accelScale;
|
||||
me.accelMag = 0.005 * simulation.accelScale;
|
||||
me.frictionAir = 0.05;
|
||||
me.lookTorque = 0.000007 * (Math.random() > 0.5 ? -1 : 1);
|
||||
me.fireDir = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
Matter.Body.setDensity(me, 0.03 + 0.0008 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
Matter.Body.setDensity(me, 0.03 + 0.0008 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
me.onDeath = function() {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
// this.vertices = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices)) //helps collisions functions work better after vertex have been changed
|
||||
@@ -1921,7 +1921,7 @@ const spawn = {
|
||||
this.explode(this.mass * 120);
|
||||
};
|
||||
me.onDeath = function() {
|
||||
if (game.difficulty > 4) {
|
||||
if (simulation.difficulty > 4) {
|
||||
spawn.bullet(this.position.x, this.position.y, this.radius / 3, 5);
|
||||
spawn.bullet(this.position.x, this.position.y, this.radius / 3, 5);
|
||||
spawn.bullet(this.position.x, this.position.y, this.radius / 3, 5);
|
||||
@@ -1983,7 +1983,7 @@ const spawn = {
|
||||
me.fireFreq = 0.006 + Math.random() * 0.002;
|
||||
me.noseLength = 0;
|
||||
me.fireAngle = 0;
|
||||
me.accelMag = 0.0005 * game.accelScale;
|
||||
me.accelMag = 0.0005 * simulation.accelScale;
|
||||
me.frictionAir = 0.05;
|
||||
me.torque = 0.0001 * me.inertia;
|
||||
me.fireDir = {
|
||||
@@ -2008,7 +2008,7 @@ const spawn = {
|
||||
//throw a mob/bullet at player
|
||||
if (this.seePlayer.recall) {
|
||||
//set direction to turn to fire
|
||||
if (!(game.cycle % this.seePlayerFreq)) {
|
||||
if (!(simulation.cycle % this.seePlayerFreq)) {
|
||||
this.fireDir = Vector.normalise(Vector.sub(this.seePlayer.position, this.position));
|
||||
// this.fireDir.y -= Math.abs(this.seePlayer.position.x - this.position.x) / 1600; //gives the bullet an arc
|
||||
}
|
||||
@@ -2023,7 +2023,7 @@ const spawn = {
|
||||
} else if (this.noseLength > 1.5) {
|
||||
//fire
|
||||
spawn.sniperBullet(this.vertices[1].x, this.vertices[1].y, 5 + Math.ceil(this.radius / 15), 4);
|
||||
const v = 20 * game.accelScale;
|
||||
const v = 20 * simulation.accelScale;
|
||||
Matter.Body.setVelocity(mob[mob.length - 1], {
|
||||
x: this.velocity.x + this.fireDir.x * v + Math.random(),
|
||||
y: this.velocity.y + this.fireDir.y * v + Math.random()
|
||||
@@ -2104,8 +2104,8 @@ const spawn = {
|
||||
launcher(x, y, radius = 30 + Math.ceil(Math.random() * 40)) {
|
||||
mobs.spawn(x, y, 3, radius, "rgb(150,150,255)");
|
||||
let me = mob[mob.length - 1];
|
||||
me.accelMag = 0.00004 * game.accelScale;
|
||||
me.fireFreq = Math.floor(420 + 90 * Math.random() * game.CDScale)
|
||||
me.accelMag = 0.00004 * simulation.accelScale;
|
||||
me.fireFreq = Math.floor(420 + 90 * Math.random() * simulation.CDScale)
|
||||
me.frictionStatic = 0;
|
||||
me.friction = 0;
|
||||
me.frictionAir = 0.02;
|
||||
@@ -2115,7 +2115,7 @@ const spawn = {
|
||||
this.seePlayerCheck();
|
||||
this.checkStatus();
|
||||
this.attraction();
|
||||
if (this.seePlayer.recall && !(game.cycle % this.fireFreq) && !mech.isBodiesAsleep) {
|
||||
if (this.seePlayer.recall && !(simulation.cycle % this.fireFreq) && !mech.isBodiesAsleep) {
|
||||
Matter.Body.setAngularVelocity(this, 0.14)
|
||||
//fire a bullet from each vertex
|
||||
for (let i = 0, len = this.vertices.length; i < len; i++) {
|
||||
@@ -2134,15 +2134,15 @@ const spawn = {
|
||||
mobs.spawn(x, y, 6, radius, "rgb(150,150,255)");
|
||||
let me = mob[mob.length - 1];
|
||||
me.isBoss = true;
|
||||
me.accelMag = 0.00008 * game.accelScale;
|
||||
me.fireFreq = Math.floor(360 * game.CDScale)
|
||||
me.accelMag = 0.00008 * simulation.accelScale;
|
||||
me.fireFreq = Math.floor(360 * simulation.CDScale)
|
||||
me.frictionStatic = 0;
|
||||
me.friction = 0;
|
||||
me.frictionAir = 0.02;
|
||||
me.memory = 420;
|
||||
me.repulsionRange = 1200000; //squared
|
||||
spawn.shield(me, x, y, 1);
|
||||
Matter.Body.setDensity(me, 0.004 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
Matter.Body.setDensity(me, 0.004 + 0.0005 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
me.onDeath = function() {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
// this.vertices = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices)) //helps collisions functions work better after vertex have been changed
|
||||
@@ -2153,7 +2153,7 @@ const spawn = {
|
||||
this.checkStatus();
|
||||
this.attraction();
|
||||
this.repulsion();
|
||||
if (this.seePlayer.recall && !(game.cycle % this.fireFreq) && !mech.isBodiesAsleep) {
|
||||
if (this.seePlayer.recall && !(simulation.cycle % this.fireFreq) && !mech.isBodiesAsleep) {
|
||||
Matter.Body.setAngularVelocity(this, 0.11)
|
||||
//fire a bullet from each vertex
|
||||
for (let i = 0, len = this.vertices.length; i < len; i++) {
|
||||
@@ -2172,9 +2172,9 @@ const spawn = {
|
||||
mobs.spawn(x, y, 5, radius, "rgb(245,180,255)");
|
||||
let me = mob[mob.length - 1];
|
||||
me.isBoss = true;
|
||||
// me.accelMag = 0.00023 * game.accelScale;
|
||||
me.accelMag = 0.00008 * game.accelScale;
|
||||
// me.fireFreq = Math.floor(30 * game.CDScale)
|
||||
// me.accelMag = 0.00023 * simulation.accelScale;
|
||||
me.accelMag = 0.00008 * simulation.accelScale;
|
||||
// me.fireFreq = Math.floor(30 * simulation.CDScale)
|
||||
me.canFire = false;
|
||||
me.closestVertex1 = 0;
|
||||
me.closestVertex2 = 1;
|
||||
@@ -2255,7 +2255,7 @@ const spawn = {
|
||||
};
|
||||
Matter.Body.setDensity(me, 0.000015); //normal is 0.001
|
||||
me.timeLeft = 420 * (0.8 + 0.4 * Math.random());
|
||||
me.accelMag = 0.00017 * game.accelScale; //* (0.8 + 0.4 * Math.random())
|
||||
me.accelMag = 0.00017 * simulation.accelScale; //* (0.8 + 0.4 * Math.random())
|
||||
me.frictionAir = 0.01 //* (0.8 + 0.4 * Math.random());
|
||||
me.restitution = 0.5;
|
||||
me.leaveBody = false;
|
||||
@@ -2302,10 +2302,10 @@ const spawn = {
|
||||
};
|
||||
Matter.Body.setDensity(me, 0.0005); //normal is 0.001
|
||||
me.g = 0.0001; //required if using 'gravity'
|
||||
me.accelMag = 0.0003 * game.accelScale;
|
||||
me.accelMag = 0.0003 * simulation.accelScale;
|
||||
me.memory = 30;
|
||||
me.leaveBody = false;
|
||||
me.seePlayerFreq = Math.round((80 + 50 * Math.random()) * game.lookFreqScale);
|
||||
me.seePlayerFreq = Math.round((80 + 50 * Math.random()) * simulation.lookFreqScale);
|
||||
me.frictionAir = 0.002;
|
||||
me.do = function() {
|
||||
this.gravity();
|
||||
@@ -2333,10 +2333,10 @@ const spawn = {
|
||||
mobs.spawn(x, y, 8, radius, "rgb(55,170,170)");
|
||||
let me = mob[mob.length - 1];
|
||||
me.isBoss = true;
|
||||
me.accelMag = 0.00075 * game.accelScale;
|
||||
me.accelMag = 0.00075 * simulation.accelScale;
|
||||
me.memory = 250;
|
||||
me.laserRange = 500;
|
||||
Matter.Body.setDensity(me, 0.0015 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
Matter.Body.setDensity(me, 0.0015 + 0.0005 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
spawn.shield(me, x, y, 1);
|
||||
me.onDeath = function() {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
@@ -2356,7 +2356,7 @@ const spawn = {
|
||||
};
|
||||
|
||||
//snake tail
|
||||
const nodes = Math.min(8 + Math.ceil(0.5 * game.difficulty), 40)
|
||||
const nodes = Math.min(8 + Math.ceil(0.5 * simulation.difficulty), 40)
|
||||
spawn.lineBoss(x + 105, y, "snakeBody", nodes);
|
||||
//constraint boss with first 3 mobs in lineboss
|
||||
consBB[consBB.length] = Constraint.create({
|
||||
@@ -2387,7 +2387,7 @@ const spawn = {
|
||||
// this.explode();
|
||||
// };
|
||||
me.collisionFilter.mask = cat.bullet | cat.player | cat.mob
|
||||
me.accelMag = 0.0004 * game.accelScale;
|
||||
me.accelMag = 0.0004 * simulation.accelScale;
|
||||
me.leaveBody = false;
|
||||
me.frictionAir = 0.02;
|
||||
me.isSnakeTail = true;
|
||||
@@ -2418,9 +2418,9 @@ const spawn = {
|
||||
let me = mob[mob.length - 1];
|
||||
me.isBoss = true;
|
||||
me.g = 0.0001; //required if using 'gravity'
|
||||
me.accelMag = 0.002 * game.accelScale;
|
||||
me.accelMag = 0.002 * simulation.accelScale;
|
||||
me.memory = 20;
|
||||
Matter.Body.setDensity(me, 0.001 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
Matter.Body.setDensity(me, 0.001 + 0.0005 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
spawn.shield(me, x, y, 1);
|
||||
me.onDeath = function() {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
@@ -2433,7 +2433,7 @@ const spawn = {
|
||||
this.attraction();
|
||||
};
|
||||
},
|
||||
shield(target, x, y, chance = Math.min(0.02 + game.difficulty * 0.005, 0.2)) {
|
||||
shield(target, x, y, chance = Math.min(0.02 + simulation.difficulty * 0.005, 0.2)) {
|
||||
if (this.allowShields && Math.random() < chance) {
|
||||
mobs.spawn(x, y, 9, target.radius + 30, "rgba(220,220,255,0.9)");
|
||||
let me = mob[mob.length - 1];
|
||||
@@ -2526,8 +2526,8 @@ const spawn = {
|
||||
x,
|
||||
y,
|
||||
spawn = "striker",
|
||||
nodes = Math.min(2 + Math.ceil(Math.random() * (game.difficulty + 2)), 8),
|
||||
//Math.ceil(Math.random() * 3) + Math.min(4,Math.ceil(game.difficulty/2)),
|
||||
nodes = Math.min(2 + Math.ceil(Math.random() * (simulation.difficulty + 2)), 8),
|
||||
//Math.ceil(Math.random() * 3) + Math.min(4,Math.ceil(simulation.difficulty/2)),
|
||||
radius = Math.ceil(Math.random() * 10) + 17, // radius of each node mob
|
||||
sideLength = Math.ceil(Math.random() * 100) + 70, // distance between each node mob
|
||||
stiffness = Math.random() * 0.03 + 0.005
|
||||
@@ -2560,8 +2560,8 @@ const spawn = {
|
||||
x,
|
||||
y,
|
||||
spawn = "striker",
|
||||
nodes = Math.min(3 + Math.ceil(Math.random() * game.difficulty + 2), 8),
|
||||
//Math.ceil(Math.random() * 3) + Math.min(4,Math.ceil(game.difficulty/2)),
|
||||
nodes = Math.min(3 + Math.ceil(Math.random() * simulation.difficulty + 2), 8),
|
||||
//Math.ceil(Math.random() * 3) + Math.min(4,Math.ceil(simulation.difficulty/2)),
|
||||
radius = Math.ceil(Math.random() * 10) + 17,
|
||||
l = Math.ceil(Math.random() * 80) + 30,
|
||||
stiffness = Math.random() * 0.06 + 0.01
|
||||
|
||||
Reference in New Issue
Block a user