diff --git a/js/engine.js b/js/engine.js index 96f9d75..f41da53 100644 --- a/js/engine.js +++ b/js/engine.js @@ -87,40 +87,40 @@ function collisionChecks(event) { //body + player collision - if (game.isBodyDamage) { - if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) { - collidePlayer(pairs[i].bodyB) - } else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) { - collidePlayer(pairs[i].bodyA) - } - } + // if (game.isBodyDamage) { + // if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) { + // collidePlayer(pairs[i].bodyB) + // } else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) { + // collidePlayer(pairs[i].bodyA) + // } + // } - function collidePlayer(obj) { - //player dmg from hitting a body - if (obj.classType === "body" && mech.collisionImmuneCycle < mech.cycle) { - const velocityThreshold = 13 - if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference - const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity)) - if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold) - } else { //block is below player only look at horizontal momentum difference - const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x) - if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold) - } + // function collidePlayer(obj) { + // //player dmg from hitting a body + // if (obj.classType === "body" && mech.collisionImmuneCycle < mech.cycle) { + // const velocityThreshold = 13 + // if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference + // const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity)) + // if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold) + // } else { //block is below player only look at horizontal momentum difference + // const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x) + // if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold) + // } - function hit(dmg) { - mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles - dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15); - mech.damage(dmg); - game.drawList.push({ //add dmg to draw queue - x: pairs[i].activeContacts[0].vertex.x, - y: pairs[i].activeContacts[0].vertex.y, - radius: dmg * 500, - color: game.mobDmgColor, - time: game.drawTime - }); - } - } - } + // function hit(dmg) { + // mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles + // dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15); + // mech.damage(dmg); + // game.drawList.push({ //add dmg to draw queue + // x: pairs[i].activeContacts[0].vertex.x, + // y: pairs[i].activeContacts[0].vertex.y, + // radius: dmg * 500, + // color: game.mobDmgColor, + // time: game.drawTime + // }); + // } + // } + // } // function collidePlayer(obj, speedThreshold = 12, massThreshold = 2) { // //player dmg from hitting a body diff --git a/js/player.js b/js/player.js index bdd507e..8fde508 100644 --- a/js/player.js +++ b/js/player.js @@ -1938,7 +1938,7 @@ const mech = { }, { name: "pilot wave", - description: "use energy to push blocks with your mouse
immune to damage from block collisions", + description: "use energy to push blocks with your mouse
field radius decreases out of line of sight", isEasyToAim: false, effect: () => { game.replaceTextLog = true; //allow text over write