From adbb9c37eca640be2fc748cccba5cec679e837bb Mon Sep 17 00:00:00 2001 From: landgreen Date: Sat, 21 Dec 2019 19:21:38 -0800 Subject: [PATCH] more pulse balance and graphics --- js/bullets.js | 48 +++++++++++++++++++++++++++++++----------------- js/game.js | 8 +++++++- js/player.js | 3 --- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/js/bullets.js b/js/bullets.js index a747f40..0809ee8 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -816,14 +816,14 @@ const b = { name: "super balls", //2 description: "fire balls that bounce with no momentum loss", ammo: 0, - ammoPack: 15, + ammoPack: 16, have: false, isStarterGun: true, fire() { - mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 15) * b.modFireRate); // cool down + mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 25 : 18) * b.modFireRate); // cool down b.muzzleFlash(20); // mobs.alert(450); - const SPEED = mech.crouch ? 45 : 28 + const SPEED = mech.crouch ? 45 : 26 const SPREAD = mech.crouch ? 0.04 : 0.14 let dir = mech.angle - SPREAD; for (let i = 0; i < 3; i++) { @@ -1909,24 +1909,38 @@ const b = { }; } - //draw laser beam - ctx.strokeStyle = "rgba(255,0,0,0.2)" - ctx.lineWidth = 25 - ctx.beginPath(); - ctx.moveTo(path[0].x, path[0].y); - ctx.lineTo(path[1].x, path[1].y); - ctx.stroke(); - ctx.strokeStyle = "#f00"; - ctx.lineWidth = 4 - ctx.beginPath(); - ctx.moveTo(path[0].x, path[0].y); - ctx.lineTo(path[1].x, path[1].y); - ctx.stroke(); - const energy = mech.fieldMeter * 0.2 mech.fieldMeter -= energy if (best.who) b.explosion(path[1], 1300 * energy) mech.fireCDcycle = mech.cycle + Math.floor(20 * b.modFireRate); // cool down + + //draw laser beam + ctx.beginPath(); + ctx.moveTo(path[0].x, path[0].y); + ctx.lineTo(path[1].x, path[1].y); + ctx.strokeStyle = "rgba(255,0,0,0.13)" + ctx.lineWidth = 60 * energy / 0.2 + ctx.stroke(); + ctx.strokeStyle = "rgba(255,0,0,0.2)" + ctx.lineWidth = 18 + ctx.stroke(); + ctx.strokeStyle = "#f00"; + ctx.lineWidth = 4 + ctx.stroke(); + + //draw little dot sparkles + const sub = Matter.Vector.sub(path[1], path[0]) + const mag = Matter.Vector.magnitude(sub) + for (let i = 0, len = Math.floor(mag * 0.03 * energy / 0.2); i < len; i++) { + const dist = Math.random() + game.drawList.push({ + x: path[0].x + sub.x * dist + 30 * (Math.random() - 0.5), + y: path[0].y + sub.y * dist + 30 * (Math.random() - 0.5), + radius: 1 + 2 * Math.random(), + color: "rgba(255,0,0,0.5)", + time: Math.floor(2 + 7 * Math.random()) + }); + } } }, { diff --git a/js/game.js b/js/game.js index f91e311..67d302a 100644 --- a/js/game.js +++ b/js/game.js @@ -301,8 +301,11 @@ const game = { } else if (keys[53]) { // 5 powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "mod"); } else if (keys[54]) { // 6 spawn mob + const pick = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)]; + spawn.allowShields = false; spawn[pick](game.mouseInGame.x, game.mouseInGame.y); + spawn.allowShields = true; } else if (keys[55]) { // 7 spawn body index = body.length spawn.bodyRect(game.mouseInGame.x, game.mouseInGame.y, 50, 50); @@ -319,8 +322,9 @@ const game = { } else if (keys[71]) { // give all guns with G // b.giveGuns("all", 1000) powerUps.gun.effect() - } else if (keys[72]) { // power ups with H + } else if (keys[72]) { // heal with H mech.addHealth(Infinity) + mech.fieldMeter = mech.fieldEnergyMax; } else if (keys[89]) { //add all mods with y powerUps.mod.effect() } else if (keys[82]) { // teleport to mouse with R @@ -330,6 +334,8 @@ const game = { y: 0 }); // game.noCameraScroll() + } else if (keys[85]) { // next level with U + level.zoneActions.nextLevel(); } } }, diff --git a/js/player.js b/js/player.js index a71ec84..a5ebafa 100644 --- a/js/player.js +++ b/js/player.js @@ -1269,9 +1269,6 @@ const mech = { ctx.stroke(); ctx.strokeStyle = "#f0f"; ctx.lineWidth = 2 - ctx.beginPath(); - ctx.moveTo(path[0].x, path[0].y); - ctx.lineTo(path[1].x, path[1].y); ctx.stroke(); //draw electricity