timeSkip
new reactor boss: timeBoss - after taking some damage it speeds up the passage of time reactor level has big doors nonrefundable tech show up in the pause menu time dilation field - move, jump, and fire 25% faster JUNK tech: closed timelike curve - spawn 5 field power ups, but every 12 seconds teleport a second into your future
This commit is contained in:
359
js/spawn.js
359
js/spawn.js
@@ -1,6 +1,6 @@
|
||||
//main object for spawning things in a level
|
||||
const spawn = {
|
||||
nonCollideBossList: ["cellBossCulture", "bomberBoss", "powerUpBoss", "orbitalBoss", "spawnerBossCulture", "growBossCulture"],
|
||||
nonCollideBossList: ["cellBossCulture", "bomberBoss", "powerUpBoss", "growBossCulture"],
|
||||
// other bosses: suckerBoss, laserBoss, tetherBoss, mantisBoss, bounceBoss, sprayBoss //these need a particular level to work so they are not included in the random pool
|
||||
randomBossList: ["shieldingBoss", "orbitalBoss", "historyBoss", "shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", "laserTargetingBoss",
|
||||
"powerUpBoss", "powerUpBossBaby", "snakeBoss", "streamBoss", "pulsarBoss", "spawnerBossCulture", "grenadierBoss", "growBossCulture", "blinkBoss",
|
||||
@@ -1031,7 +1031,7 @@ const spawn = {
|
||||
|
||||
me.isSpawnBoss = true;
|
||||
me.spawnID = spawnID
|
||||
me.accelMag = 0.00018 * simulation.accelScale;
|
||||
me.accelMag = 0.00022 * simulation.accelScale;
|
||||
me.memory = Infinity;
|
||||
me.showHealthBar = false;
|
||||
me.isVerticesChange = true
|
||||
@@ -1039,7 +1039,7 @@ const spawn = {
|
||||
me.seePlayerFreq = Math.floor(14 + 7 * Math.random())
|
||||
me.seeAtDistance2 = 200000 //1400000;
|
||||
me.stroke = "transparent"
|
||||
me.collisionFilter.mask = cat.player | cat.bullet //| cat.body //| cat.map //"rgba(255,60,0,0.3)"
|
||||
me.collisionFilter.mask = cat.player | cat.bullet | cat.body | cat.map //"rgba(255,60,0,0.3)"
|
||||
// Matter.Body.setDensity(me, 0.0014) // normal density is 0.001
|
||||
Matter.Body.setAngularVelocity(me, 0.12 * (Math.random() - 0.5))
|
||||
// spawn.shield(me, x, y, 1);
|
||||
@@ -1047,7 +1047,7 @@ const spawn = {
|
||||
me.onHit = function() { //run this function on hitting player
|
||||
this.explode();
|
||||
};
|
||||
me.damageReduction = 0.2 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1);
|
||||
me.damageReduction = 0.14 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1);
|
||||
me.doAwake = function() {
|
||||
this.alwaysSeePlayer();
|
||||
this.checkStatus();
|
||||
@@ -1741,6 +1741,68 @@ const spawn = {
|
||||
}
|
||||
}
|
||||
},
|
||||
// timeBoss(x, y, radius = 25) {
|
||||
// mobs.spawn(x, y, 12, radius, "#000");
|
||||
// let me = mob[mob.length - 1];
|
||||
// me.isBoss = true;
|
||||
// me.stroke = "transparent"; //used for drawSneaker
|
||||
// me.eventHorizon = 1100; //required for black hole
|
||||
// me.eventHorizonGoal = 1100; //required for black hole
|
||||
// me.seeAtDistance2 = (me.eventHorizon + 1200) * (me.eventHorizon + 1200); //vision limit is event horizon
|
||||
// me.accelMag = 0.00006 * simulation.accelScale;
|
||||
// // me.collisionFilter.mask = cat.player | cat.bullet //| cat.body
|
||||
// // me.frictionAir = 0.005;
|
||||
// me.memory = Infinity;
|
||||
// Matter.Body.setDensity(me, 0.03); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
// me.onDeath = function() {
|
||||
// powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
// };
|
||||
// me.damageReduction = 0.23 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1)
|
||||
// me.do = function() {
|
||||
// //keep it slow, to stop issues from explosion knock backs
|
||||
// if (!(simulation.cycle % this.seePlayerFreq)) {
|
||||
// if (this.distanceToPlayer2() < this.seeAtDistance2) { //&& !m.isCloak ignore cloak for black holes
|
||||
// this.locatePlayer();
|
||||
// if (!this.seePlayer.yes) this.seePlayer.yes = true;
|
||||
// } else if (this.seePlayer.recall) {
|
||||
// this.lostPlayer();
|
||||
// }
|
||||
// }
|
||||
// this.checkStatus();
|
||||
// if (this.seePlayer.recall) {
|
||||
// //accelerate towards the player
|
||||
// const forceMag = this.accelMag * this.mass;
|
||||
// const dx = this.seePlayer.position.x - this.position.x
|
||||
// const dy = this.seePlayer.position.y - this.position.y
|
||||
// const mag = Math.sqrt(dx * dx + dy * dy)
|
||||
// this.force.x += forceMag * dx / mag;
|
||||
// this.force.y += forceMag * dy / mag;
|
||||
|
||||
// //eventHorizon waves in and out
|
||||
// const eventHorizon = this.eventHorizon * (1 + 0.2 * Math.sin(simulation.cycle * 0.008))
|
||||
// // zoom camera in and out with the event horizon
|
||||
|
||||
// //draw darkness
|
||||
// if (!simulation.isTimeSkipping) {
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.position.x, this.position.y, eventHorizon, 0, 2 * Math.PI);
|
||||
// ctx.fillStyle = "rgba(0,0,0,0.05)";
|
||||
// ctx.fill();
|
||||
// //when player is inside event horizon
|
||||
// if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
|
||||
// // if (!(simulation.cycle % 10)) simulation.timePlayerSkip(5)
|
||||
// // if (!(simulation.cycle % 2)) simulation.timePlayerSkip(1)
|
||||
// simulation.timePlayerSkip(2)
|
||||
|
||||
// // if (m.immuneCycle < m.cycle) {
|
||||
// // if (m.energy > 0) m.energy -= 0.004
|
||||
// // if (m.energy < 0.1) m.damage(0.00017 * simulation.dmgScale);
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
suckerBoss(x, y, radius = 25) {
|
||||
mobs.spawn(x, y, 12, radius, "#000");
|
||||
let me = mob[mob.length - 1];
|
||||
@@ -1808,7 +1870,6 @@ const spawn = {
|
||||
y: this.velocity.y + velocity.y
|
||||
});
|
||||
}
|
||||
|
||||
//accelerate towards the player
|
||||
const forceMag = this.accelMag * this.mass;
|
||||
const dx = this.seePlayer.position.x - this.position.x
|
||||
@@ -1816,11 +1877,8 @@ const spawn = {
|
||||
const mag = Math.sqrt(dx * dx + dy * dy)
|
||||
this.force.x += forceMag * dx / mag;
|
||||
this.force.y += forceMag * dy / mag;
|
||||
|
||||
//eventHorizon waves in and out
|
||||
const eventHorizon = this.eventHorizon * (1 + 0.2 * Math.sin(simulation.cycle * 0.008))
|
||||
// zoom camera in and out with the event horizon
|
||||
|
||||
const eventHorizon = this.eventHorizon * (1 + 0.2 * Math.sin(simulation.cycle * 0.008)) // zoom camera in and out with the event horizon
|
||||
//draw darkness
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.position.x, this.position.y, eventHorizon * 0.2, 0, 2 * Math.PI);
|
||||
@@ -2229,88 +2287,88 @@ const spawn = {
|
||||
}
|
||||
spawn.allowShields = true;
|
||||
},
|
||||
// timeSkipBoss(x, y, radius = 55) {
|
||||
// mobs.spawn(x, y, 6, radius, '#000');
|
||||
// let me = mob[mob.length - 1];
|
||||
// me.isBoss = true;
|
||||
// // me.stroke = "transparent"; //used for drawSneaker
|
||||
// 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 * 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.0005 + 0.00018 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
// spawn.shield(me, x, y, 1);
|
||||
timeSkipBoss(x, y, radius = 55) {
|
||||
mobs.spawn(x, y, 6, radius, '#000');
|
||||
let me = mob[mob.length - 1];
|
||||
me.isBoss = true;
|
||||
// me.stroke = "transparent"; //used for drawSneaker
|
||||
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 * 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.0005 + 0.00018 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
spawn.shield(me, x, y, 1);
|
||||
|
||||
|
||||
// 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)
|
||||
// };
|
||||
// me.do = function() {
|
||||
// //keep it slow, to stop issues from explosion knock backs
|
||||
// if (this.speed > 8) {
|
||||
// Matter.Body.setVelocity(this, {
|
||||
// x: this.velocity.x * 0.99,
|
||||
// y: this.velocity.y * 0.99
|
||||
// });
|
||||
// }
|
||||
// this.seePlayerCheck();
|
||||
// this.checkStatus();
|
||||
// this.attraction()
|
||||
// if (!simulation.isTimeSkipping) {
|
||||
// const compress = 1
|
||||
// if (this.timeSkipLastCycle < simulation.cycle - compress &&
|
||||
// Vector.magnitude(Vector.sub(this.position, player.position)) < this.eventHorizon) {
|
||||
// this.timeSkipLastCycle = simulation.cycle
|
||||
// simulation.timeSkip(compress)
|
||||
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)
|
||||
};
|
||||
me.do = function() {
|
||||
//keep it slow, to stop issues from explosion knock backs
|
||||
if (this.speed > 8) {
|
||||
Matter.Body.setVelocity(this, {
|
||||
x: this.velocity.x * 0.99,
|
||||
y: this.velocity.y * 0.99
|
||||
});
|
||||
}
|
||||
this.seePlayerCheck();
|
||||
this.checkStatus();
|
||||
this.attraction()
|
||||
if (!simulation.isTimeSkipping) {
|
||||
const compress = 1
|
||||
if (this.timeSkipLastCycle < simulation.cycle - compress &&
|
||||
Vector.magnitude(Vector.sub(this.position, player.position)) < this.eventHorizon) {
|
||||
this.timeSkipLastCycle = simulation.cycle
|
||||
simulation.timeSkip(compress)
|
||||
|
||||
// this.fill = `rgba(0,0,0,${0.4+0.6*Math.random()})`
|
||||
// this.stroke = "#014"
|
||||
// this.isShielded = false;
|
||||
// this.isDropPowerUp = true;
|
||||
// this.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob; //can't touch bullets
|
||||
this.fill = `rgba(0,0,0,${0.4+0.6*Math.random()})`
|
||||
this.stroke = "#014"
|
||||
this.isShielded = false;
|
||||
this.isDropPowerUp = true;
|
||||
this.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob; //can't touch bullets
|
||||
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI);
|
||||
// ctx.fillStyle = "#fff";
|
||||
// ctx.globalCompositeOperation = "destination-in"; //in or atop
|
||||
// ctx.fill();
|
||||
// ctx.globalCompositeOperation = "source-over";
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI);
|
||||
// ctx.clip();
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI);
|
||||
ctx.fillStyle = "#fff";
|
||||
ctx.globalCompositeOperation = "destination-in"; //in or atop
|
||||
ctx.fill();
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI);
|
||||
ctx.clip();
|
||||
|
||||
// // ctx.beginPath();
|
||||
// // ctx.arc(this.position.x, this.position.y, 9999, 0, 2 * Math.PI);
|
||||
// // ctx.fillStyle = "#000";
|
||||
// // ctx.fill();
|
||||
// // ctx.strokeStyle = "#000";
|
||||
// // ctx.stroke();
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.position.x, this.position.y, 9999, 0, 2 * Math.PI);
|
||||
// ctx.fillStyle = "#000";
|
||||
// ctx.fill();
|
||||
// ctx.strokeStyle = "#000";
|
||||
// ctx.stroke();
|
||||
|
||||
// // ctx.beginPath();
|
||||
// // ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI);
|
||||
// // ctx.fillStyle = `rgba(0,0,0,${0.05*Math.random()})`;
|
||||
// // ctx.fill();
|
||||
// // ctx.strokeStyle = "#000";
|
||||
// // ctx.stroke();
|
||||
// } else {
|
||||
// this.isShielded = true;
|
||||
// this.isDropPowerUp = false;
|
||||
// this.seePlayer.recall = false
|
||||
// this.fill = "transparent"
|
||||
// this.stroke = "transparent"
|
||||
// this.collisionFilter.mask = cat.player | cat.map | cat.body | cat.mob; //can't touch bullets
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI);
|
||||
// ctx.fillStyle = `rgba(0,0,0,${0.05*Math.random()})`;
|
||||
// ctx.fill();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI);
|
||||
// ctx.fillStyle = `rgba(0,0,0,${0.05*Math.random()})`;
|
||||
// ctx.fill();
|
||||
// ctx.strokeStyle = "#000";
|
||||
// ctx.stroke();
|
||||
} else {
|
||||
this.isShielded = true;
|
||||
this.isDropPowerUp = false;
|
||||
this.seePlayer.recall = false
|
||||
this.fill = "transparent"
|
||||
this.stroke = "transparent"
|
||||
this.collisionFilter.mask = cat.player | cat.map | cat.body | cat.mob; //can't touch bullets
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI);
|
||||
ctx.fillStyle = `rgba(0,0,0,${0.05*Math.random()})`;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beamer(x, y, radius = 15 + Math.ceil(Math.random() * 15)) {
|
||||
mobs.spawn(x, y, 4, radius, "rgb(255,0,190)");
|
||||
let me = mob[mob.length - 1];
|
||||
@@ -3456,33 +3514,6 @@ const spawn = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//invulnerable every other revolution
|
||||
// me.isInvulnerable = false
|
||||
// me.invulnerable = function() {
|
||||
// //draw trigger angle
|
||||
// if (this.laserAngle % (4 * Math.PI) > 2 * Math.PI) {
|
||||
// if (!this.isInvulnerable) {
|
||||
// this.isInvulnerable = true
|
||||
// if (this.damageReduction) this.startingDamageReduction = this.damageReduction
|
||||
// this.damageReduction = 0
|
||||
// }
|
||||
// } else if (this.isInvulnerable) {
|
||||
// this.isInvulnerable = false
|
||||
// this.damageReduction = this.startingDamageReduction
|
||||
// }
|
||||
// if (this.isInvulnerable) {
|
||||
// ctx.beginPath();
|
||||
// let vertices = this.vertices;
|
||||
// ctx.moveTo(vertices[0].x, vertices[0].y);
|
||||
// for (let j = 1; j < vertices.length; j++) ctx.lineTo(vertices[j].x, vertices[j].y);
|
||||
// ctx.lineTo(vertices[0].x, vertices[0].y);
|
||||
// ctx.lineWidth = 20;
|
||||
// ctx.strokeStyle = "rgba(255,255,255,0.7)";
|
||||
// ctx.stroke();
|
||||
// }
|
||||
// }
|
||||
|
||||
me.do = function() {
|
||||
this.invulnerable();
|
||||
this.checkStatus();
|
||||
@@ -3893,6 +3924,93 @@ const spawn = {
|
||||
// }
|
||||
};
|
||||
},
|
||||
timeBoss(x, y, radius = 50, isSpawnBossPowerUp = true) {
|
||||
mobs.spawn(x, y, 0, radius, `hsl(0, 100%, 50%)`) // "rgb(201,202,225)");
|
||||
let me = mob[mob.length - 1];
|
||||
Matter.Body.rotate(me, 2 * Math.PI * Math.random());
|
||||
me.isBoss = true;
|
||||
Matter.Body.setDensity(me, 0.001); //normal is 0.001
|
||||
me.inertia = Infinity;
|
||||
me.damageReduction = 0.04 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1)
|
||||
me.startingDamageReduction = me.damageReduction
|
||||
me.isInvulnerable = false
|
||||
me.frictionAir = 0.01
|
||||
me.restitution = 1
|
||||
me.friction = 0
|
||||
me.collisionFilter.mask = cat.bullet | cat.player | cat.body | cat.map | cat.mob
|
||||
Matter.Body.setVelocity(me, { x: 10 * (Math.random() - 0.5), y: 10 * (Math.random() - 0.5) });
|
||||
me.seePlayer.recall = 1;
|
||||
spawn.spawnOrbitals(me, radius + 15, 1)
|
||||
|
||||
// me.skipRate = 1 + Math.floor(simulation.difficulty*0.02)
|
||||
// spawn.shield(me, x, y, 1);
|
||||
|
||||
me.onDamage = function() {
|
||||
if (this.health < this.nextHealthThreshold) {
|
||||
this.health = this.nextHealthThreshold - 0.01
|
||||
this.nextHealthThreshold = Math.floor(this.health * 4) / 4 //0.75,0.5,0.25
|
||||
this.invulnerableCount = 360 + simulation.difficulty * 4 //how long does invulnerable time last
|
||||
this.isInvulnerable = true
|
||||
this.damageReduction = 0
|
||||
// requestAnimationFrame(() => { simulation.timePlayerSkip(300) }); //wrapping in animation frame prevents errors, probably
|
||||
}
|
||||
};
|
||||
me.onDeath = function() {
|
||||
if (isSpawnBossPowerUp) powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
requestAnimationFrame(() => { simulation.timePlayerSkip(30) }); //wrapping in animation frame prevents errors, probably
|
||||
};
|
||||
|
||||
me.cycle = Math.floor(360 * Math.random())
|
||||
me.nextHealthThreshold = 0.75
|
||||
me.invulnerableCount = 0
|
||||
// console.log(me.mass) //100
|
||||
me.do = function() {
|
||||
this.cycle++
|
||||
this.fill = `hsl(${this.cycle*0.5}, 100%, 80%)`;
|
||||
// this.fill = `hsl(${270 + 50*Math.sin(this.cycle*0.02)}, 100%, 60%)`;
|
||||
this.seePlayer.recall = 1
|
||||
//maintain speed //faster in the vertical to help avoid repeating patterns
|
||||
if (this.speed < 0.01) {
|
||||
const unit = Vector.sub(player.position, this.position)
|
||||
Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(unit), 0.1));
|
||||
} else {
|
||||
if (Math.abs(this.velocity.y) < 9) Matter.Body.setVelocity(this, { x: this.velocity.x, y: this.velocity.y * 1.02 });
|
||||
if (Math.abs(this.velocity.x) < 6.5) Matter.Body.setVelocity(this, { x: this.velocity.x * 1.02, y: this.velocity.y });
|
||||
}
|
||||
|
||||
if (this.isInvulnerable) {
|
||||
this.invulnerableCount--
|
||||
if (this.invulnerableCount < 0) {
|
||||
this.isInvulnerable = false
|
||||
this.damageReduction = this.startingDamageReduction
|
||||
}
|
||||
//time dilation
|
||||
if (!simulation.isTimeSkipping) {
|
||||
requestAnimationFrame(() => { simulation.timePlayerSkip(1) }); //wrapping in animation frame prevents errors, probably
|
||||
// if (!(simulation.cycle % 10))
|
||||
|
||||
//draw invulnerable
|
||||
ctx.beginPath();
|
||||
let vertices = this.vertices;
|
||||
ctx.moveTo(vertices[0].x, vertices[0].y);
|
||||
for (let j = 1; j < vertices.length; j++) ctx.lineTo(vertices[j].x, vertices[j].y);
|
||||
ctx.lineTo(vertices[0].x, vertices[0].y);
|
||||
ctx.lineWidth = 15 + 6 * Math.random();
|
||||
ctx.strokeStyle = `rgba(255,255,255,${0.5+0.2*Math.random()})`;
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
this.checkStatus();
|
||||
//horizontal attraction
|
||||
// const xMag = 0.0005
|
||||
// if (player.position.x > this.position.x + 200) {
|
||||
// this.force.x += xMag * this.mass;
|
||||
// } else if (player.position.x < this.position.x - 200) {
|
||||
// this.force.x -= xMag * this.mass;
|
||||
// }
|
||||
};
|
||||
},
|
||||
bounceBullet(x, y, velocity = { x: 0, y: 0 }, radius = 11, sides = 6) {
|
||||
//bullets
|
||||
mobs.spawn(x, y, sides, radius, "rgb(255,0,155)");
|
||||
@@ -5668,7 +5786,7 @@ const spawn = {
|
||||
x: Math.cos(time),
|
||||
y: Math.sin(time)
|
||||
}
|
||||
Matter.Body.setPosition(this, Vector.add(who.position, Vector.mult(orbit, radius))) //bullets move with player
|
||||
Matter.Body.setPosition(this, Vector.add(Vector.add(who.position, who.velocity), Vector.mult(orbit, radius))) //bullets move with player
|
||||
//damage player
|
||||
if (Matter.Query.collides(this, [player]).length > 0 && !(m.isCloak && tech.isIntangible) && m.immuneCycle < m.cycle) {
|
||||
m.immuneCycle = m.cycle + tech.collisionImmuneCycles; //player is immune to damage for 30 cycles
|
||||
@@ -5685,26 +5803,24 @@ const spawn = {
|
||||
}
|
||||
};
|
||||
},
|
||||
orbitalBoss(x, y, radius = 88) {
|
||||
orbitalBoss(x, y, radius = 70) {
|
||||
const nodeBalance = Math.random()
|
||||
const nodes = Math.min(15, Math.floor(2 + 4 * nodeBalance + 0.75 * Math.sqrt(simulation.difficulty)))
|
||||
mobs.spawn(x, y, nodes, radius, "rgb(255,0,150)");
|
||||
let me = mob[mob.length - 1];
|
||||
me.isBoss = true;
|
||||
|
||||
Matter.Body.setDensity(me, 0.0017 + 0.0002 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
|
||||
|
||||
me.stroke = "transparent"; //used for drawGhost
|
||||
me.seeAtDistance2 = 2000000;
|
||||
me.collisionFilter.mask = cat.bullet | cat.player | cat.body | cat.map
|
||||
me.memory = Infinity;
|
||||
me.frictionAir = 0.04;
|
||||
me.accelMag = 0.0003 * simulation.accelScale
|
||||
me.collisionFilter.mask = cat.player | cat.bullet //| cat.body
|
||||
me.accelMag = 0.0007 * simulation.accelScale
|
||||
spawn.shield(me, x, y, 1);
|
||||
|
||||
const rangeInnerVsOuter = Math.random()
|
||||
let speed = (0.009 + 0.0011 * Math.sqrt(simulation.difficulty)) * ((Math.random() < 0.5) ? 1 : -1)
|
||||
let range = radius + 400 + 200 * rangeInnerVsOuter + nodes * 7
|
||||
let range = radius + 300 + 200 * rangeInnerVsOuter + nodes * 7
|
||||
for (let i = 0; i < nodes; i++) spawn.orbital(me, range, i / nodes * 2 * Math.PI, speed)
|
||||
const orbitalIndexes = [] //find indexes for all the current nodes
|
||||
for (let i = 0; i < nodes; i++) orbitalIndexes.push(mob.length - 1 - i)
|
||||
@@ -5718,10 +5834,9 @@ const spawn = {
|
||||
me.onDeath = function() {
|
||||
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
|
||||
};
|
||||
me.damageReduction = 0.25 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1)
|
||||
me.damageReduction = 0.18 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1)
|
||||
me.do = function() {
|
||||
// this.armor();
|
||||
this.seePlayerCheckByDistance();
|
||||
this.seePlayerByHistory();
|
||||
this.checkStatus();
|
||||
this.attraction();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user