diff --git a/js/bullets.js b/js/bullets.js index 191ccfd..f463dc8 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -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(); } } diff --git a/js/game.js b/js/game.js index 780dde7..4f3e9ff 100644 --- a/js/game.js +++ b/js/game.js @@ -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(); diff --git a/js/powerups.js b/js/powerups.js index 7915ecb..85febd0 100644 --- a/js/powerups.js +++ b/js/powerups.js @@ -4,16 +4,19 @@ const powerUps = { choose(type, index) { if (type === "gun") { b.giveGuns(index) - // game.replaceTextLog = true; - // game.makeTextLog(`${game.SVGleftMouse} ${b.guns[index].name}

${b.guns[index].description}`, 500); - // game.replaceTextLog = false; + game.replaceTextLog = true; + game.makeTextLog(`${game.SVGleftMouse} ${b.guns[index].name}

${b.guns[index].description}`, 500); + game.replaceTextLog = false; } else if (type === "field") { mech.setField(index) + game.replaceTextLog = true; + game.makeTextLog(`${game.SVGrightMouse} ${mech.fieldUpgrades[mech.fieldMode].name}

${mech.fieldUpgrades[mech.fieldMode].description}`, 600); + game.replaceTextLog = false; } else if (type === "mod") { b.giveMod(index) - // game.replaceTextLog = true; - // game.makeTextLog(`
  ${b.mods[index].name}

${b.mods[index].description}`, 500); - // game.replaceTextLog = false; + game.replaceTextLog = true; + game.makeTextLog(`
  ${b.mods[index].name}

${b.mods[index].description}`, 500); + game.replaceTextLog = false; } document.body.style.cursor = "none"; document.getElementById("choose-grid").style.display = "none"