diff --git a/js/level.js b/js/level.js index 5bac4af..a549776 100644 --- a/js/level.js +++ b/js/level.js @@ -24,7 +24,7 @@ const level = { // game.levelsCleared = 3; //for testing to simulate possible mobs spawns // b.giveGuns(0) // set a starting gun for testing - mech.fieldUpgrades[4]() //give a field power up for testing + mech.fieldUpgrades[3]() //give a field power up for testing } else { spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns this[this.levels[this.onLevel]](); //picks the current map from the the levels array diff --git a/js/mobs.js b/js/mobs.js index bb66987..fec265c 100644 --- a/js/mobs.js +++ b/js/mobs.js @@ -98,12 +98,10 @@ const mobs = { }, seePlayerFreq: 20 + Math.round(Math.random() * 20), //how often NPC checks to see where player is, lower numbers have better vision foundPlayer() { - if (!mech.isStealth) { - this.locatePlayer(); - if (!this.seePlayer.yes) { - this.alertNearByMobs(); - this.seePlayer.yes = true; - } + this.locatePlayer(); + if (!this.seePlayer.yes) { + this.alertNearByMobs(); + this.seePlayer.yes = true; } }, lostPlayer() { @@ -113,16 +111,18 @@ const mobs = { }, memory: 120, //default time to remember player's location locatePlayer() { - // updates mob's memory of player location - this.seePlayer.recall = this.memory + Math.round(this.memory * Math.random()); //seconds before mob falls a sleep - this.seePlayer.position.x = player.position.x; - this.seePlayer.position.y = player.position.y; - }, - locatePlayerByDist() { - if (this.distanceToPlayer2() < this.locateRange) { - this.locatePlayer(); + if (!mech.isStealth) { + // updates mob's memory of player location + this.seePlayer.recall = this.memory + Math.round(this.memory * Math.random()); //seconds before mob falls a sleep + this.seePlayer.position.x = player.position.x; + this.seePlayer.position.y = player.position.y; } }, + // locatePlayerByDist() { + // if (this.distanceToPlayer2() < this.locateRange) { + // this.locatePlayer(); + // } + // }, seePlayerCheck() { if (!(game.cycle % this.seePlayerFreq)) { if ( diff --git a/js/player.js b/js/player.js index acc2f3e..8184e01 100644 --- a/js/player.js +++ b/js/player.js @@ -973,7 +973,7 @@ const mech = { game.makeTextLog("Negative Mass Field
(right mouse or space bar)

field nullifies gravity
player can hold more massive objects
decreased field shielding efficiency

", 1200); mech.setHoldDefaults(); mech.holdingMassScale = 0.05; //can hold heavier blocks with lower cost to jumping - mech.fieldShieldingScale = 20; + mech.fieldShieldingScale = 4; // mech.fieldArc = 1; //field covers full 360 degrees // mech.grabRange = 150; // mech.fieldArc = 1 //0.08; @@ -1007,29 +1007,20 @@ const mech = { // zeroG(bullet); //works fine, but not that noticeable and maybe not worth the possible performance hit // zeroG(mob); //mobs are too irregular to make this work? - player.force.y -= player.mass * mech.gravity; // + 0.005 * Math.sin(game.cycle / 10); //wobble + player.force.y -= 0.0009 + player.mass * mech.gravity; //constant upward drift + Matter.Body.setVelocity(player, { + x: player.velocity.x, + y: player.velocity.y * 0.97 + }); - //allow player to fly up and down a bit - flyForce = 0.003; if (keys[83] || keys[40]) { //down - player.force.y += flyForce - Matter.Body.setVelocity(player, { //friction, only when flying - x: player.velocity.x, - y: player.velocity.y * 0.97 - }); - } else if (keys[87] || keys[38]) { //up - player.force.y -= flyForce - Matter.Body.setVelocity(player, { //friction, only when flying - x: player.velocity.x, - y: player.velocity.y * 0.95 - }); - // mech.fieldMeter -= DRAIN; //extra energy used to fly upwards + player.force.y += 0.003 } //add extra friction for horizontal motion if (keys[65] || keys[68] || keys[37] || keys[39]) { Matter.Body.setVelocity(player, { - x: player.velocity.x * 0.95, + x: player.velocity.x * 0.88, y: player.velocity.y }); } @@ -1128,9 +1119,10 @@ const mech = { }, () => { mech.fieldMode = 6; - game.makeTextLog("Metamaterial Refractive Optics
(right mouse or space bar)

localized invisibility field
greatly decreased field shielding efficiency

", 1200); + game.makeTextLog("Metamaterial Refractive Optics
(right mouse or space bar)

player is invisible while field is active.
decreased field shielding efficiency

", 1200); + //
player can't see while field is active

", 1200); mech.setHoldDefaults(); - mech.fieldShieldingScale = 10; + mech.fieldShieldingScale = 5; // mech.grabRange = 160; mech.hold = function () { @@ -1141,14 +1133,15 @@ const mech = { mech.holding(); mech.throw(); } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < game.cycle) { - const DRAIN = 0.0003 //mech.fieldRegen = 0.0015 + const DRAIN = 0.0002 //mech.fieldRegen = 0.0015 if (mech.fieldMeter > DRAIN) { mech.fieldMeter -= DRAIN; + mech.isStealth = true //isStealth is checked in mob foundPlayer() if (mech.crouch) { - mech.grabRange = mech.grabRange * 0.96 + 240 * 0.04; + mech.grabRange = mech.grabRange * 0.96 + 360 * 0.04; } else { - mech.grabRange = mech.grabRange * 0.96 + 160 * 0.04; + mech.grabRange = mech.grabRange * 0.96 + 180 * 0.04; } ctx.beginPath(); @@ -1160,9 +1153,8 @@ const mech = { ctx.fillStyle = `rgba(0,30,50,${0.5+0.07*Math.random()})` //"rgba(210,230," + HUE + ",0.5)"; ctx.fill(); - mech.isStealth = false //isStealth is checked in mob foundPlayer() - mech.pushMobs360(130); - mech.isStealth = true //isStealth is checked in mob foundPlayer() + // mech.isStealth = false //isStealth is checked in mob foundPlayer() + mech.pushMobs360(150); mech.grabPowerUp(); mech.lookForPickUp(); } else {