more pulse balance and graphics

This commit is contained in:
landgreen
2019-12-21 19:21:38 -08:00
parent 720ca13f9f
commit adbb9c37ec
3 changed files with 38 additions and 21 deletions

View File

@@ -816,14 +816,14 @@ const b = {
name: "super balls", //2 name: "super balls", //2
description: "fire balls that <strong>bounce</strong> with no momentum loss", description: "fire balls that <strong>bounce</strong> with no momentum loss",
ammo: 0, ammo: 0,
ammoPack: 15, ammoPack: 16,
have: false, have: false,
isStarterGun: true, isStarterGun: true,
fire() { 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); b.muzzleFlash(20);
// mobs.alert(450); // mobs.alert(450);
const SPEED = mech.crouch ? 45 : 28 const SPEED = mech.crouch ? 45 : 26
const SPREAD = mech.crouch ? 0.04 : 0.14 const SPREAD = mech.crouch ? 0.04 : 0.14
let dir = mech.angle - SPREAD; let dir = mech.angle - SPREAD;
for (let i = 0; i < 3; i++) { 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 const energy = mech.fieldMeter * 0.2
mech.fieldMeter -= energy mech.fieldMeter -= energy
if (best.who) b.explosion(path[1], 1300 * energy) if (best.who) b.explosion(path[1], 1300 * energy)
mech.fireCDcycle = mech.cycle + Math.floor(20 * b.modFireRate); // cool down 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())
});
}
} }
}, },
{ {

View File

@@ -301,8 +301,11 @@ const game = {
} else if (keys[53]) { // 5 } else if (keys[53]) { // 5
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "mod"); powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "mod");
} else if (keys[54]) { // 6 spawn mob } else if (keys[54]) { // 6 spawn mob
const pick = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)]; const pick = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)];
spawn.allowShields = false;
spawn[pick](game.mouseInGame.x, game.mouseInGame.y); spawn[pick](game.mouseInGame.x, game.mouseInGame.y);
spawn.allowShields = true;
} else if (keys[55]) { // 7 spawn body } else if (keys[55]) { // 7 spawn body
index = body.length index = body.length
spawn.bodyRect(game.mouseInGame.x, game.mouseInGame.y, 50, 50); 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 } else if (keys[71]) { // give all guns with G
// b.giveGuns("all", 1000) // b.giveGuns("all", 1000)
powerUps.gun.effect() powerUps.gun.effect()
} else if (keys[72]) { // power ups with H } else if (keys[72]) { // heal with H
mech.addHealth(Infinity) mech.addHealth(Infinity)
mech.fieldMeter = mech.fieldEnergyMax;
} else if (keys[89]) { //add all mods with y } else if (keys[89]) { //add all mods with y
powerUps.mod.effect() powerUps.mod.effect()
} else if (keys[82]) { // teleport to mouse with R } else if (keys[82]) { // teleport to mouse with R
@@ -330,6 +334,8 @@ const game = {
y: 0 y: 0
}); });
// game.noCameraScroll() // game.noCameraScroll()
} else if (keys[85]) { // next level with U
level.zoneActions.nextLevel();
} }
} }
}, },

View File

@@ -1269,9 +1269,6 @@ const mech = {
ctx.stroke(); ctx.stroke();
ctx.strokeStyle = "#f0f"; ctx.strokeStyle = "#f0f";
ctx.lineWidth = 2 ctx.lineWidth = 2
ctx.beginPath();
ctx.moveTo(path[0].x, path[0].y);
ctx.lineTo(path[1].x, path[1].y);
ctx.stroke(); ctx.stroke();
//draw electricity //draw electricity