not a full patch, just syncing between my 2 computers

This commit is contained in:
landgreen
2022-12-28 12:35:03 -08:00
parent 3cbc2c7941
commit feb8824bc7
12 changed files with 473 additions and 313 deletions

View File

@@ -1192,23 +1192,21 @@ const mobs = {
this.alive = false; //triggers mob removal in mob[i].replace(i)
if (this.isDropPowerUp) {
// if (true) { //spawn zombie on death
// // console.log(this)
// this.leaveBody = false;
// let count = 45 //delay spawn cycles
// let cycle = () => {
// if (count > 0) {
// if (m.alive) requestAnimationFrame(cycle);
// if (!simulation.paused && !simulation.isChoosing) {
// count--
// }
// } else {
// spawn.zombie(this.position.x, this.position.y, this.radius, this.vertices.length, this.fill) // zombie(x, y, radius, sides, color)
// }
// }
// requestAnimationFrame(cycle);
// }
if (this.isSoonZombie) { //spawn zombie on death
this.leaveBody = false;
let count = 45 //delay spawn cycles
let cycle = () => {
if (count > 0) {
if (m.alive) requestAnimationFrame(cycle);
if (!simulation.paused && !simulation.isChoosing) {
count--
}
} else {
spawn.zombie(this.position.x, this.position.y, this.radius, this.vertices.length, this.fill) // zombie(x, y, radius, sides, color)
}
}
requestAnimationFrame(cycle);
}
@@ -1248,19 +1246,19 @@ const mobs = {
mobs.mobDeaths++
if (Math.random() < tech.sporesOnDeath) {
const amount = Math.min(25, Math.floor(2 + this.mass * (0.5 + 0.5 * Math.random())))
if (tech.isSporeFlea) {
const len = Math.min(25, Math.floor(2 + this.mass * (0.5 + 0.5 * Math.random()))) / 2
const len = amount / 2
for (let i = 0; i < len; i++) {
const speed = 10 + 5 * Math.random()
const angle = 2 * Math.PI * Math.random()
b.flea(this.position, { x: speed * Math.cos(angle), y: speed * Math.sin(angle) })
}
} else if (tech.isSporeWorm) {
const len = Math.min(25, Math.floor(2 + this.mass * (0.5 + 0.5 * Math.random()))) / 2
const len = amount / 2
for (let i = 0; i < len; i++) b.worm(this.position)
} else {
const len = Math.min(25, Math.floor(2 + this.mass * (0.5 + 0.5 * Math.random())))
for (let i = 0; i < len; i++) b.spore(this.position)
for (let i = 0; i < amount; i++) b.spore(this.position)
}
} else if (tech.isExplodeMob) {
b.explosion(this.position, Math.min(700, Math.sqrt(this.mass + 6) * (30 + 60 * Math.random())))