added text on new mods, mines don't stick on flat ground anymore

This commit is contained in:
landgreen
2020-01-11 10:17:45 -08:00
parent 7068a48903
commit 63a6eb4e22
3 changed files with 15 additions and 13 deletions

View File

@@ -1057,9 +1057,7 @@ const b = {
gun = options[Math.floor(Math.random() * options.length)]
}
if (gun === "all") {
if (b.guns[b.activeGun].switchOff) b.guns[b.activeGun].switchOff(); //run code when switching away from a gun
b.activeGun = 0;
if (b.guns[b.activeGun].switchOn) b.guns[b.activeGun].switchOn(); //run code when switching to a new gun
b.inventoryGun = 0;
for (let i = 0; i < b.guns.length; i++) {
b.inventory[i] = i;
@@ -1069,7 +1067,6 @@ const b = {
} else {
if (!b.guns[gun].have) b.inventory.push(gun);
if (b.activeGun === null) b.activeGun = gun //if no active gun switch to new gun
if (b.guns[b.activeGun].switchOn) b.guns[b.activeGun].switchOn(); //run code when switching to a new gun
b.guns[gun].have = true;
b.guns[gun].ammo = b.guns[gun].ammoPack * ammoPacks;
}
@@ -1813,7 +1810,12 @@ const b = {
for (let i = 0; i < collide.length; i++) {
if (collide[i].bodyA.collisionFilter.category === cat.map || collide[i].bodyB.collisionFilter.category === cat.map) {
this.seeFrom = Vector.add(this.position, Vector.mult(collide[i].normal, -20)) //find the location 20 pixels perpendicular to the map
Matter.Body.setStatic(this, true)
// console.log()
const angle = Matter.Vector.angle(collide[i].normal, {
x: 1,
y: 0
})
if (angle > -0.1) Matter.Body.setStatic(this, true)
this.arm();
}
}

View File

@@ -213,9 +213,7 @@ const game = {
},
switchGun() {
if (b.modNoAmmo) b.modNoAmmo = 1 //this prevents hacking the mod by switching guns
// if (b.guns[b.activeGun].switchOff) b.guns[b.activeGun].switchOff(); //run code when switching away from a gun
b.activeGun = b.inventory[b.inventoryGun];
// if (b.guns[b.activeGun].switchOn) b.guns[b.activeGun].switchOn(); //run code when switching to a new gun
game.updateGunHUD();
game.boldActiveGunHUD();
// mech.drop();
@@ -437,7 +435,6 @@ const game = {
b.guns[i].have = false;
if (b.guns[i].ammo != Infinity) b.guns[i].ammo = 0;
}
// if (b.activeGun && b.guns[b.activeGun].switchOff) b.guns[b.activeGun].switchOff(); //run code when switching away from a gun
b.activeGun = null;
b.setModDefaults(); //remove mods
game.updateModHUD();

View File

@@ -4,16 +4,19 @@ const powerUps = {
choose(type, index) {
if (type === "gun") {
b.giveGuns(index)
// game.replaceTextLog = true;
// game.makeTextLog(`${game.SVGleftMouse} <strong style='font-size:30px;'>${b.guns[index].name}</strong><br><br>${b.guns[index].description}`, 500);
// game.replaceTextLog = false;
game.replaceTextLog = true;
game.makeTextLog(`${game.SVGleftMouse} <strong style='font-size:30px;'>${b.guns[index].name}</strong><br><br>${b.guns[index].description}`, 500);
game.replaceTextLog = false;
} else if (type === "field") {
mech.setField(index)
game.replaceTextLog = true;
game.makeTextLog(`${game.SVGrightMouse}<strong style='font-size:30px;'> ${mech.fieldUpgrades[mech.fieldMode].name}</strong><br><span class='faded'></span><br>${mech.fieldUpgrades[mech.fieldMode].description}`, 600);
game.replaceTextLog = false;
} else if (type === "mod") {
b.giveMod(index)
// game.replaceTextLog = true;
// game.makeTextLog(`<div class="circle mod"></div> &nbsp; <strong style='font-size:30px;'>${b.mods[index].name}</strong><br><br> ${b.mods[index].description}`, 500);
// game.replaceTextLog = false;
game.replaceTextLog = true;
game.makeTextLog(`<div class="circle mod"></div> &nbsp; <strong style='font-size:30px;'>${b.mods[index].name}</strong><br><br> ${b.mods[index].description}`, 500);
game.replaceTextLog = false;
}
document.body.style.cursor = "none";
document.getElementById("choose-grid").style.display = "none"