diff --git a/js/bullets.js b/js/bullets.js index 49fc624..d829c03 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -1003,12 +1003,14 @@ const b = { suck(body) suck(mob) suck(powerUp) + suck(bullet) suck([player]) } else { mag = 0.1 suck(body) suck(mob) suck(powerUp) + suck(bullet) suck([player]) } //keep bomb in place diff --git a/js/index.js b/js/index.js index 4ff60d5..b55f68b 100644 --- a/js/index.js +++ b/js/index.js @@ -2,6 +2,8 @@ /* TODO: ******************************************* ***************************************************** +add a key that player picks up and needs to set on the exit door to open it + add Boss levels diff --git a/js/level.js b/js/level.js index cd7d819..29c2457 100644 --- a/js/level.js +++ b/js/level.js @@ -663,7 +663,10 @@ const level = { spawn.bodyRect(4700, -350, 50, 200, 0.9); spawn.bodyRect(4900, -100, 300, 300, 0.7); spawn.boost(5350, 275, 2850); - spawn.mapRect(6050, -700, 600, 1200); + // spawn.mapRect(6050, -700, 450, 1200); + spawn.mapRect(6050, -1060, 450, 1560); + spawn.mapVertex(6275, -2100, "0 0 450 0 300 -2500 150 -2500") + //right tall tower spawn.mapRect(3700, -3200, 100, 800); spawn.mapRect(4700, -2910, 100, 510); diff --git a/js/player.js b/js/player.js index ab704f9..f7d5687 100644 --- a/js/player.js +++ b/js/player.js @@ -374,7 +374,8 @@ const mech = { } function randomizeHealth() { - mech.health = 0.5 + 1 * Math.random() + mech.health = 0.5 + Math.random() + if (mech.health > 1) mech.health = 1; mech.displayHealth(); } @@ -720,22 +721,37 @@ const mech = { //draw field const range = this.grabRange - 20; ctx.beginPath(); - ctx.arc(this.pos.x, this.pos.y, range, this.angle - Math.PI * this.fieldArc, this.angle + Math.PI * this.fieldArc, false); + ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - Math.PI * mech.fieldArc, mech.angle + Math.PI * mech.fieldArc, false); + ctx.strokeStyle = "#9bd" //"rgba(110, 200, 235, " + (0.5 + 0.1 * Math.random()) + ")" + ctx.lineWidth = 2; + ctx.lineCap = "butt" + ctx.stroke(); let eye = 13; - ctx.lineTo(mech.pos.x + eye * Math.cos(this.angle), mech.pos.y + eye * Math.sin(this.angle)); - if (this.holdingTarget) { - ctx.fillStyle = "rgba(110,170,200," + (0.05 + 0.1 * Math.random()) + ")"; + let aMag = 0.75 * Math.PI * mech.fieldArc + let a = mech.angle + aMag + let cp1x = mech.pos.x + 0.6 * range * Math.cos(a) + let cp1y = mech.pos.y + 0.6 * range * Math.sin(a) + ctx.quadraticCurveTo(cp1x, cp1y, mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle)) + a = mech.angle - aMag + cp1x = mech.pos.x + 0.6 * range * Math.cos(a) + cp1y = mech.pos.y + 0.6 * range * Math.sin(a) + ctx.quadraticCurveTo(cp1x, cp1y, mech.pos.x + 1 * range * Math.cos(mech.angle - Math.PI * mech.fieldArc), mech.pos.y + 1 * range * Math.sin(mech.angle - Math.PI * mech.fieldArc)) + // ctx.lineTo(mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle)); + + if (mech.holdingTarget) { + ctx.fillStyle = "rgba(110,170,200," + (0.02 + mech.fieldMeter * (0.1 + 0.05 * Math.random())) + ")"; } else { - ctx.fillStyle = "rgba(110,170,200," + (0.15 + 0.15 * Math.random()) + ")"; + ctx.fillStyle = "rgba(110,170,200," + (0.07 + mech.fieldMeter * (0.2 + 0.15 * Math.random())) + ")"; } ctx.fill(); + //draw random lines in field for cool effect - let offAngle = this.angle + 2 * Math.PI * this.fieldArc * (Math.random() - 0.5); + let offAngle = mech.angle + 1.7 * Math.PI * mech.fieldArc * (Math.random() - 0.5); ctx.beginPath(); eye = 15; - ctx.moveTo(mech.pos.x + eye * Math.cos(this.angle), mech.pos.y + eye * Math.sin(this.angle)); - ctx.lineTo(this.pos.x + range * Math.cos(offAngle), this.pos.y + range * Math.sin(offAngle)); - ctx.strokeStyle = "rgba(120,170,255,0.4)"; + ctx.moveTo(mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle)); + ctx.lineTo(mech.pos.x + range * Math.cos(offAngle), mech.pos.y + range * Math.sin(offAngle)); + ctx.strokeStyle = "rgba(120,170,255,0.6)"; ctx.lineWidth = 1; ctx.stroke(); }, @@ -944,7 +960,7 @@ const mech = { }, { name: "time dilation field", - description: "stop time  while field is active
can fire while field is active", + description: "stop time while field is active
can fire while field is active", effect: () => { mech.fieldMode = 1; mech.fieldText(); @@ -1059,10 +1075,12 @@ const mech = { ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - arc, mech.angle + arc, false); ctx.lineTo(mech.pos.x + 13 * Math.cos(mech.angle), mech.pos.y + 13 * Math.sin(mech.angle)); if (mech.holdingTarget) { - ctx.fillStyle = "rgba(255,50,150," + (0.05 + 0.1 * Math.random()) + ")"; + ctx.fillStyle = "rgba(255,50,150," + (0.01 + mech.fieldMeter * (0.1 + 0.1 * Math.random())) + ")"; } else { - ctx.fillStyle = "rgba(255,50,150," + (0.13 + 0.18 * Math.random()) + ")"; + ctx.fillStyle = "rgba(255,50,150," + (0.02 + mech.fieldMeter * (0.18 + 0.18 * Math.random())) + ")"; } + // ctx.fillStyle = "rgba(110,170,200," + (0.02 + mech.fieldMeter * (0.08 + 0.1 * Math.random())) + ")"; + // ctx.fillStyle = "rgba(110,170,200," + (0.06 + mech.fieldMeter * (0.1 + 0.18 * Math.random())) + ")"; ctx.fill(); //draw random lines in field for cool effect @@ -1088,7 +1106,7 @@ const mech = { }, { name: "negative mass field", - description: "field nullifies  gravity
player can hold more massive objects
can fire while field is active", + description: "field nullifies  gravity
player can hold more massive objects
can fire while field is active", effect: () => { mech.fieldMode = 3; mech.fieldText(); @@ -1201,7 +1219,7 @@ const mech = { const grabRange2 = 85 + 70 * Math.sin(mech.cycle / 37) const grabRange3 = 80 + 80 * Math.sin(mech.cycle / 47) const netGrabRange = Math.max(grabRange1, grabRange2, grabRange3) - ctx.fillStyle = "rgba(110,170,200," + (0.15 + 0.15 * Math.random()) + ")"; + ctx.fillStyle = "rgba(110,170,200," + (0.04 + mech.fieldMeter * (0.12 + 0.13 * Math.random())) + ")"; ctx.beginPath(); ctx.arc(mech.pos.x, mech.pos.y, grabRange1, 0, 2 * Math.PI); ctx.fill(); @@ -1272,7 +1290,7 @@ const mech = { player.collisionFilter.mask = 0x000001 //0x010011 is normals ctx.beginPath(); - ctx.arc(mech.pos.x, mech.pos.y, mech.grabRange, 0, 2 * Math.PI); + ctx.arc(mech.pos.x, mech.pos.y, mech.grabRange / (0.3 + 0.7 * mech.fieldMeter), 0, 2 * Math.PI); ctx.globalCompositeOperation = "destination-in"; //in or atop ctx.fillStyle = "rgba(255,255,255,0.25)"; ctx.fill(); diff --git a/js/powerups.js b/js/powerups.js index 64ae5d6..554a827 100644 --- a/js/powerups.js +++ b/js/powerups.js @@ -11,7 +11,7 @@ const powerUps = { let heal = (this.size / 40) ** 2 heal = Math.min(1 - mech.health, heal) mech.addHealth(heal); - if (!game.lastLogTime && heal > 0) game.makeTextLog(" heal " + (heal * 100).toFixed(0) + "%", 300) + if (!game.lastLogTime && heal > 0) game.makeTextLog(" heal " + (heal * 100).toFixed(0) + "%", 300) } }, ammo: { @@ -41,13 +41,13 @@ const powerUps = { } if (target.ammo === Infinity) { mech.fieldMeter = 1; - if (!game.lastLogTime) game.makeTextLog("+energy", 300); + if (!game.lastLogTime) game.makeTextLog("+energy", 300); } else { //ammo given scales as mobs take more hits to kill const ammo = Math.ceil((target.ammoPack * (0.6 + 0.04 * Math.random())) / b.dmgScale); target.ammo += ammo; game.updateGunHUD(); - if (!game.lastLogTime) game.makeTextLog("+" + ammo + " ammo for " + target.name + "", 300); + if (!game.lastLogTime) game.makeTextLog("+" + ammo + " ammo for " + target.name + "", 300); } } }, @@ -129,7 +129,7 @@ const powerUps = { const ammo = Math.ceil(b.guns[ammoTarget].ammoPack * 2); b.guns[ammoTarget].ammo += ammo; game.updateGunHUD(); - game.makeTextLog("+" + ammo + " ammo for " + b.guns[ammoTarget].name + "", 300); + game.makeTextLog("+" + ammo + " ammo for " + b.guns[ammoTarget].name + "", 300); } } }, diff --git a/style.css b/style.css index b538516..7c394ca 100644 --- a/style.css +++ b/style.css @@ -234,6 +234,9 @@ summary { background-color: rgba(255, 255, 255, 0.5); } +em { + opacity: 0.7; +} .wrapper { display: grid;