vacuum bomb balance
This commit is contained in:
@@ -124,7 +124,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
activeGun: null, //current gun in use by player
|
activeGun: null, //current gun in use by player
|
||||||
inventoryGun: 0,
|
inventoryGun: 0,
|
||||||
inventory: [0], //list of what guns player has // 0 starts with basic gun
|
inventory: [], //list of what guns player has // 0 starts with basic gun
|
||||||
giveGuns(gun = "all", ammoPacks = 2) {
|
giveGuns(gun = "all", ammoPacks = 2) {
|
||||||
if (gun === "all") {
|
if (gun === "all") {
|
||||||
b.activeGun = 0;
|
b.activeGun = 0;
|
||||||
@@ -1085,15 +1085,15 @@ const b = {
|
|||||||
name: "grenades",
|
name: "grenades",
|
||||||
description: "fire a bomb that explodes on contact or after 1.6 seconds",
|
description: "fire a bomb that explodes on contact or after 1.6 seconds",
|
||||||
ammo: 0,
|
ammo: 0,
|
||||||
ammoPack: 17,
|
ammoPack: 14,
|
||||||
have: false,
|
have: false,
|
||||||
fire() {
|
fire() {
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
const dir = mech.angle; // + Math.random() * 0.05;
|
const dir = mech.angle; // + Math.random() * 0.05;
|
||||||
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 15 * b.modBulletSize, b.fireAttributes(dir, false));
|
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 15 * b.modBulletSize, b.fireAttributes(dir, false));
|
||||||
b.fireProps(mech.crouch ? 45 : 32, mech.crouch ? 41 : 32, dir, me); //cd , speed
|
b.fireProps(mech.crouch ? 40 : 25, mech.crouch ? 41 : 32, dir, me); //cd , speed
|
||||||
b.drawOneBullet(bullet[me].vertices);
|
b.drawOneBullet(bullet[me].vertices);
|
||||||
Matter.Body.setDensity(bullet[me], 0.000001);
|
// Matter.Body.setDensity(bullet[me], 0.000001);
|
||||||
bullet[me].totalCycles = 100;
|
bullet[me].totalCycles = 100;
|
||||||
bullet[me].endCycle = game.cycle + Math.floor(70 * b.modBulletsLastLonger);
|
bullet[me].endCycle = game.cycle + Math.floor(70 * b.modBulletsLastLonger);
|
||||||
bullet[me].restitution = 0.25;
|
bullet[me].restitution = 0.25;
|
||||||
@@ -1112,7 +1112,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "vacuum bomb",
|
name: "vacuum bomb",
|
||||||
description: "fire a huge bomb that sucks before it explodes<br>2 second fuse",
|
description: "fire a huge bomb that sucks before it explodes",
|
||||||
ammo: 0,
|
ammo: 0,
|
||||||
ammoPack: 5,
|
ammoPack: 5,
|
||||||
have: false,
|
have: false,
|
||||||
@@ -1125,7 +1125,7 @@ const b = {
|
|||||||
|
|
||||||
b.drawOneBullet(bullet[me].vertices);
|
b.drawOneBullet(bullet[me].vertices);
|
||||||
// Matter.Body.setDensity(bullet[me], 0.001);
|
// Matter.Body.setDensity(bullet[me], 0.001);
|
||||||
bullet[me].endCycle = game.cycle + Math.floor(120 * b.modBulletsLastLonger);
|
bullet[me].endCycle = game.cycle + Math.floor((mech.crouch ? 100 : 150) * b.modBulletsLastLonger);
|
||||||
bullet[me].endCycleLength = bullet[me].endCycle - game.cycle
|
bullet[me].endCycleLength = bullet[me].endCycle - game.cycle
|
||||||
// bullet[me].restitution = 0.3;
|
// bullet[me].restitution = 0.3;
|
||||||
// bullet[me].frictionAir = 0.01;
|
// bullet[me].frictionAir = 0.01;
|
||||||
@@ -1145,7 +1145,7 @@ const b = {
|
|||||||
this.force.y += this.mass * 0.0022;
|
this.force.y += this.mass * 0.0022;
|
||||||
|
|
||||||
//before the explosion suck in stuff
|
//before the explosion suck in stuff
|
||||||
if (game.cycle > this.endCycle - 35) {
|
if (game.cycle > this.endCycle - 35 && !mech.isBodiesAsleep) {
|
||||||
const that = this
|
const that = this
|
||||||
let mag = 0.1
|
let mag = 0.1
|
||||||
|
|
||||||
@@ -1165,11 +1165,13 @@ const b = {
|
|||||||
suck(body)
|
suck(body)
|
||||||
suck(mob)
|
suck(mob)
|
||||||
suck(powerUp)
|
suck(powerUp)
|
||||||
|
suck([player])
|
||||||
} else {
|
} else {
|
||||||
mag = 0.1
|
mag = 0.1
|
||||||
suck(body)
|
suck(body)
|
||||||
suck(mob)
|
suck(mob)
|
||||||
suck(powerUp)
|
suck(powerUp)
|
||||||
|
suck([player])
|
||||||
}
|
}
|
||||||
|
|
||||||
//keep bomb in place
|
//keep bomb in place
|
||||||
@@ -1177,6 +1179,12 @@ const b = {
|
|||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
});
|
});
|
||||||
|
//draw suck
|
||||||
|
const radius = 9 * this.explodeRad * (this.endCycle - game.cycle) / this.endCycleLength
|
||||||
|
ctx.fillStyle = "rgba(255,255,255,0.2)";
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(this.position.x, this.position.y, radius, 0, 2 * Math.PI);
|
||||||
|
ctx.fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw timer
|
//draw timer
|
||||||
|
|||||||
@@ -297,9 +297,9 @@ const game = {
|
|||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "gun");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "gun");
|
||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "ammo");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "ammo");
|
||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "field");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "field");
|
||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "mod");
|
|
||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
||||||
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "heal");
|
||||||
|
if (!powerUps.haveAllMods) powerUps.spawn(game.mouseInGame.x, game.mouseInGame.y, "mod");
|
||||||
}
|
}
|
||||||
if (keys[89]) { //add all mods with y
|
if (keys[89]) { //add all mods with y
|
||||||
for (let i = 0; i < b.mods.length; i++) {
|
for (let i = 0; i < b.mods.length; i++) {
|
||||||
|
|||||||
18
js/player.js
18
js/player.js
@@ -374,26 +374,28 @@ const mech = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function randomizeHealth() {
|
function randomizeHealth() {
|
||||||
mech.health = 0.5 + 0.5 * Math.random()
|
mech.health = 0.5 + 1 * Math.random()
|
||||||
mech.displayHealth();
|
mech.displayHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
function randomizeGuns() {
|
function randomizeGuns() {
|
||||||
|
const length = b.inventory.length
|
||||||
|
//removes guns and ammo
|
||||||
|
b.inventory = [];
|
||||||
b.activeGun = null;
|
b.activeGun = null;
|
||||||
b.inventory = []; //removes guns and ammo
|
b.inventoryGun = 0;
|
||||||
for (let i = 0, len = b.guns.length; i < len; ++i) {
|
for (let i = 0, len = b.guns.length; i < len; ++i) {
|
||||||
b.guns[i].have = false;
|
b.guns[i].have = false;
|
||||||
if (b.guns[i].ammo !== Infinity) b.guns[i].ammo = 0;
|
if (b.guns[i].ammo !== Infinity) b.guns[i].ammo = 0;
|
||||||
}
|
}
|
||||||
if (game.levelsCleared > 0 && Math.random() < 0.95) powerUps.gun.effect();
|
for (let i = 0; i < length; i++) {
|
||||||
if (game.levelsCleared > 1 && Math.random() < 0.89) powerUps.gun.effect();
|
powerUps.gun.effect();
|
||||||
if (game.levelsCleared > 3 && Math.random() < 0.6) powerUps.gun.effect();
|
}
|
||||||
if (game.levelsCleared > 5 && Math.random() < 0.5) powerUps.gun.effect();
|
|
||||||
if (game.levelsCleared > 7 && Math.random() < 0.4) powerUps.gun.effect();
|
|
||||||
//randomize ammo
|
//randomize ammo
|
||||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||||
if (b.guns[b.inventory[i]].ammo !== Infinity) {
|
if (b.guns[b.inventory[i]].ammo !== Infinity) {
|
||||||
b.guns[b.inventory[i]].ammo = Math.max(0, Math.floor(2.2 * b.guns[b.inventory[i]].ammo * (Math.random() - 0.15)))
|
b.guns[b.inventory[i]].ammo = Math.max(0, Math.floor(5 * b.guns[b.inventory[i]].ammo * (Math.random() - 0.25)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game.makeGunHUD(); //update gun HUD
|
game.makeGunHUD(); //update gun HUD
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ const powerUps = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
haveAllMods: false,
|
||||||
mod: {
|
mod: {
|
||||||
name: "mod",
|
name: "mod",
|
||||||
color: "#a8f",
|
color: "#a8f",
|
||||||
@@ -94,8 +94,7 @@ const powerUps = {
|
|||||||
let newMod = options[Math.floor(Math.random() * options.length)]
|
let newMod = options[Math.floor(Math.random() * options.length)]
|
||||||
b.giveMod(newMod)
|
b.giveMod(newMod)
|
||||||
game.makeTextLog(`<strong style='font-size:30px;'>${b.mods[newMod].name}</strong><br> <p>${b.mods[newMod].description}</p>`, 1200);
|
game.makeTextLog(`<strong style='font-size:30px;'>${b.mods[newMod].name}</strong><br> <p>${b.mods[newMod].description}</p>`, 1200);
|
||||||
} else {
|
if (options.length < 2) powerUps.haveAllMods = true
|
||||||
//what should happen if you have all the mods?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -121,18 +120,9 @@ const powerUps = {
|
|||||||
// newGun = 4; //makes every gun you pick up this type //enable for testing one gun
|
// newGun = 4; //makes every gun you pick up this type //enable for testing one gun
|
||||||
if (b.activeGun === null) {
|
if (b.activeGun === null) {
|
||||||
b.activeGun = newGun //if no active gun switch to new gun
|
b.activeGun = newGun //if no active gun switch to new gun
|
||||||
game.makeTextLog(
|
game.makeTextLog("Use <strong>left mouse</strong> to fire weapon.", Infinity);
|
||||||
// "<br><br><br><br><div class='wrapper'> <div class = 'grid-box'><strong>left mouse</strong>: fire weapon</div> <div class = 'grid-box'> <span class = 'mouse'>️<span class='mouse-line'></span></span> </div></div>",
|
|
||||||
"Use <strong>left mouse</strong> to fire weapon.",
|
|
||||||
Infinity
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
|
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
|
||||||
// if (b.inventory.length === 1) { //on the second gun pick up tell player how to change guns
|
|
||||||
// game.makeTextLog(`(<strong>Q</strong>, <strong>E</strong>, and <strong>mouse wheel</strong> change weapons)<br><br><strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
|
|
||||||
// } else {
|
|
||||||
// game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
|
|
||||||
// }
|
|
||||||
b.guns[newGun].have = true;
|
b.guns[newGun].have = true;
|
||||||
b.inventory.push(newGun);
|
b.inventory.push(newGun);
|
||||||
b.guns[newGun].ammo += b.guns[newGun].ammoPack * 2;
|
b.guns[newGun].ammo += b.guns[newGun].ammoPack * 2;
|
||||||
@@ -160,7 +150,7 @@ const powerUps = {
|
|||||||
powerUps.spawn(x, y, "gun");
|
powerUps.spawn(x, y, "gun");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Math.random() < 0.008) {
|
if (Math.random() < 0.008 && !powerUps.haveAllMods) {
|
||||||
powerUps.spawn(x, y, "mod");
|
powerUps.spawn(x, y, "mod");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -172,7 +162,7 @@ const powerUps = {
|
|||||||
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
|
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
|
||||||
if (mech.fieldMode === 0) {
|
if (mech.fieldMode === 0) {
|
||||||
powerUps.spawn(x, y, "field")
|
powerUps.spawn(x, y, "field")
|
||||||
} else if (Math.random() < 0.35) {
|
} else if (Math.random() < 0.35 && !powerUps.haveAllMods) {
|
||||||
powerUps.spawn(x, y, "mod")
|
powerUps.spawn(x, y, "mod")
|
||||||
} else if (Math.random() < 0.27) {
|
} else if (Math.random() < 0.27) {
|
||||||
powerUps.spawn(x, y, "field");
|
powerUps.spawn(x, y, "field");
|
||||||
|
|||||||
Reference in New Issue
Block a user