From ba2eb2d1ff9cc7b9e33ce2ad74eb210ad5fcf73c Mon Sep 17 00:00:00 2001 From: lilgreenland Date: Mon, 3 Feb 2020 15:06:09 -0800 Subject: [PATCH] working on cellBoss --- js/level.js | 9 +++++---- js/spawn.js | 14 +++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/js/level.js b/js/level.js index d10a275..b58a2d6 100644 --- a/js/level.js +++ b/js/level.js @@ -1180,13 +1180,14 @@ const level = { //building 2 spawn.mapRect(-4450, -600, 2300, 750); spawn.mapRect(-2225, -500, 175, 550); - spawn.boost(-2800, -600, 1150); + spawn.mapRect(-2600, -975, 450, 50); + // spawn.boost(-2800, -600, 1150); spawn.mapRect(-3450, -1325, 550, 50); spawn.mapRect(-3425, -2200, 525, 50); - spawn.mapRect(-2600, -1750, 450, 50); + spawn.mapRect(-2600, -1700, 450, 50); spawn.mapRect(-2600, -2450, 450, 50); spawn.bodyRect(-2275, -2700, 50, 60); - spawn.bodyRect(-2600, -1975, 250, 225); + spawn.bodyRect(-2600, -1925, 250, 225); spawn.bodyRect(-3415, -1425, 100, 100); spawn.bodyRect(-3400, -1525, 100, 100); spawn.bodyRect(-3305, -1425, 100, 100); @@ -1240,7 +1241,7 @@ const level = { const x = -2000 - Math.floor(1600 * Math.random()); const y = -2700 - Math.floor(600 * Math.random()); const d = 800; - for (let i = 0; i < 7; i++) { + for (let i = 0; i < 6; i++) { spawn.cellBoss(x + Math.floor(d * (Math.random() - 0.5)), y + Math.floor(d * (Math.random() - 0.5))); } } diff --git a/js/spawn.js b/js/spawn.js index 1ca6bf7..1fbda6c 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -142,16 +142,16 @@ const spawn = { this.attraction(); }; }, - cellBoss(x, y, radius = 20 + 60 * Math.random()) { + cellBoss(x, y, radius = 20 + 40 * Math.random()) { mobs.spawn(x, y, 0, radius, "rgba(0,150,155,0.7)"); let me = mob[mob.length - 1]; me.isCell = true; - me.accelMag = 0.00024 * game.accelScale; - me.memory = 60; + me.accelMag = 0.00018 * game.accelScale; + me.memory = 40; me.frictionAir = 0.012 me.seePlayerFreq = Math.floor(11 + 7 * Math.random()) - me.seeAtDistance2 = 1500000; - me.cellMassMax = 90 + me.seeAtDistance2 = 1400000; + me.cellMassMax = 80 me.collisionFilter.mask = cat.player | cat.bullet Matter.Body.setDensity(me, 0.0005) // normal density is 0.001 // this reduces life by half and decreases knockback @@ -166,14 +166,14 @@ const spawn = { this.split(); }; me.onDamage = function (dmg) { - if (Math.random() < 0.16 * dmg * Math.sqrt(this.mass) && this.health > dmg) this.split(); + if (Math.random() < 0.18 * dmg * Math.sqrt(this.mass) && this.health > dmg) this.split(); } me.do = function () { if (!mech.isBodiesAsleep) { this.seePlayerByDistOrLOS(); this.attraction(); - if (this.mass < this.cellMassMax) { //grow cell radius + if (this.seePlayer.recall && this.mass < this.cellMassMax) { //grow cell radius const scale = 1 + 0.0002 * this.cellMassMax / this.mass; Matter.Body.scale(this, scale, scale); this.radius = Math.sqrt(this.mass * k / Math.PI)