added laser
This commit is contained in:
@@ -204,7 +204,7 @@ const level = {
|
|||||||
},
|
},
|
||||||
//empty map for testing mobs
|
//empty map for testing mobs
|
||||||
intro() {
|
intro() {
|
||||||
b.giveGuns(0, 1000)
|
// b.giveGuns(0, 1000)
|
||||||
game.zoomScale = 1000 //1400 is normal
|
game.zoomScale = 1000 //1400 is normal
|
||||||
game.zoomTransition(1600, 1)
|
game.zoomTransition(1600, 1)
|
||||||
|
|
||||||
|
|||||||
@@ -62,20 +62,24 @@ const powerUps = {
|
|||||||
effect() {
|
effect() {
|
||||||
//only get ammo for guns player has
|
//only get ammo for guns player has
|
||||||
let target;
|
let target;
|
||||||
|
console.log(b.inventory.length)
|
||||||
if (b.inventory.length > 0) {
|
if (b.inventory.length > 0) {
|
||||||
//add ammo to a gun in inventory
|
//add ammo to a gun in inventory
|
||||||
target = b.guns[b.inventory[Math.floor(Math.random() * (b.inventory.length))]];
|
target = b.guns[b.inventory[Math.floor(Math.random() * (b.inventory.length))]];
|
||||||
|
//try twice to give ammo to a gun with ammo, not Infinity
|
||||||
|
if (target.ammo === Infinity) target = b.guns[Math.floor(Math.random() * b.guns.length)];
|
||||||
|
if (target.ammo === Infinity) target = b.guns[Math.floor(Math.random() * b.guns.length)];
|
||||||
} else {
|
} else {
|
||||||
//if you don't have a gun just add ammo to a random gun
|
//if you don't have any guns just add ammo to a random gun you don't have yet
|
||||||
target = b.guns[Math.floor(Math.random() * b.guns.length)];
|
target = b.guns[Math.floor(Math.random() * b.guns.length)];
|
||||||
}
|
}
|
||||||
//ammo given scales as mobs take more hits to kill
|
|
||||||
const ammo = Math.ceil((target.ammoPack * (0.60 + 0.5 * Math.random())) / b.dmgScale);
|
|
||||||
target.ammo += ammo;
|
|
||||||
if (target.ammo === Infinity) {
|
if (target.ammo === Infinity) {
|
||||||
mech.fieldMeter = 1;
|
mech.fieldMeter = 1;
|
||||||
game.makeTextLog("+energy", 180);
|
game.makeTextLog("+energy", 180);
|
||||||
} else {
|
} else {
|
||||||
|
//ammo given scales as mobs take more hits to kill
|
||||||
|
const ammo = Math.ceil((target.ammoPack * (0.60 + 0.5 * Math.random())) / b.dmgScale);
|
||||||
|
target.ammo += ammo;
|
||||||
game.updateGunHUD();
|
game.updateGunHUD();
|
||||||
game.makeTextLog("+" + ammo + " ammo: " + target.name, 180);
|
game.makeTextLog("+" + ammo + " ammo: " + target.name, 180);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user