diff --git a/js/bullets.js b/js/bullets.js
index feb9172..01e3cbf 100644
--- a/js/bullets.js
+++ b/js/bullets.js
@@ -14,7 +14,7 @@ const b = {
isModBulletsLastLonger: null,
modIsImmortal: null,
modSpores: null,
- isModAoEImmunity: null,
+ isModTempResist: null,
isModDroneOnDamage: null,
modExtraDmg: null,
annihilation: null,
@@ -29,7 +29,7 @@ const b = {
b.modCount = 0;
b.modFireRate = 1;
b.modExplosionRadius = 1;
- b.isModAoEImmunity = false;
+ b.isModTempResist = false;
b.modBulletSize = 1;
b.isModDroneOnDamage = false;
b.modEnergySiphon = 0;
@@ -100,10 +100,10 @@ const b = {
},
{
name: "ceramic plating",
- description: "immune to explosions
immune to enemy field effects",
+ description: "protection from to high temperatures
5x less damage from explosions and lasers",
have: false, //5
effect: () => {
- b.isModAoEImmunity = true; //good for guns with explosions
+ b.isModTempResist = true; //good for guns with explosions
}
},
{
@@ -414,7 +414,11 @@ const b = {
sub = Matter.Vector.sub(bullet[me].position, player.position);
dist = Matter.Vector.magnitude(sub);
if (dist < radius) {
- if (!b.isModAoEImmunity) mech.damage(radius * 0.0002);
+ if (b.isModTempResist) {
+ mech.damage(radius * 0.00004);
+ } else {
+ mech.damage(radius * 0.0002);
+ }
knock = Matter.Vector.mult(Matter.Vector.normalise(sub), -Math.sqrt(dmg) * player.mass / 30);
player.force.x += knock.x;
player.force.y += knock.y;
@@ -705,7 +709,7 @@ const b = {
},
{
name: "rail gun", //1
- description: "electro-magnetically launch a dense rod
hold left mouse to charge release to fire", //and repel enemies
+ description: "electro-magnetically launch a dense rod
hold left mouse to charge, release to fire", //and repel enemies
ammo: 0,
ammoPack: 7,
have: false,
@@ -1561,7 +1565,7 @@ const b = {
},
{
name: "drones", //13
- description: "fire drones that seek out enemies
follows mouse if no targets are found",
+ description: "deploy drones that seek out enemies
collisions reduce drone cycles by 1 second",
ammo: 0,
ammoPack: 20,
have: false,
@@ -1579,7 +1583,7 @@ const b = {
restitution: 1,
dmg: 0.13 + b.modExtraDmg, //damage done in addition to the damage from momentum
lookFrequency: 83 + Math.floor(41 * Math.random()),
- endCycle: game.cycle + Math.floor((900 + 360 * Math.random()) * b.isModBulletsLastLonger),
+ endCycle: game.cycle + Math.floor((1080 + 360 * Math.random()) * b.isModBulletsLastLonger),
classType: "bullet",
collisionFilter: {
category: 0x000100,
@@ -1590,6 +1594,10 @@ const b = {
isFollowMouse: true,
onDmg() {
this.lockedOn = null
+ if (this.endCycle > game.cycle + 180) {
+ this.endCycle -= 60
+ if (game.cycle + 180 > this.endCycle) this.endCycle = game.cycle + 180
+ }
},
onEnd() {},
do() {
@@ -1658,6 +1666,73 @@ const b = {
b.fireProps(mech.crouch ? 14 : 10, mech.crouch ? 40 : 1, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices);
}
+ }, {
+ name: "laser-bot", //14
+ description: "deploy bots that fire lasers at nearby enemies
bots last for one level",
+ ammo: 0,
+ ammoPack: 1,
+ have: false,
+ isStarterGun: false,
+ fire() {
+ const THRUST = 0.004
+ const dir = mech.angle;
+ const me = bullet.length;
+ const RADIUS = (15 + 8 * Math.random()) * b.modBulletSize
+ const LENGTH = 0.6 + 0.8 * Math.random()
+
+ bullet[me] = Bodies.rectangle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), RADIUS * LENGTH, RADIUS / LENGTH, {
+ angle: dir,
+ // inertia: Infinity,
+ // friction: 0,
+ density: 0.001, //normal is 0.001
+ frictionAir: 0.06,
+ restitution: 0.8,
+ dmg: b.modExtraDmg, // 0.14 //damage done in addition to the damage from momentum
+ minDmgSpeed: 2,
+ lookFrequency: 7 + Math.floor(17 * Math.random()),
+ endCycle: Infinity,
+ classType: "bullet",
+ collisionFilter: {
+ category: 0x000100,
+ mask: 0x010111 //self, mob,map,body collide
+ },
+ range: 300,
+ lockedOn: null,
+ onDmg() {
+ this.lockedOn = null
+ // this.endCycle -= 120; //lose 2 seconds after damage is done
+ },
+ onEnd() {},
+ do() {
+ if (!(game.cycle % this.lookFrequency)) {
+ this.lockedOn = null;
+ let closeDist = Infinity;
+ for (let i = 0, len = mob.length; i < len; ++i) {
+ const TARGET_VECTOR = Matter.Vector.sub(mech.pos, mob[i].position)
+ const DIST = Matter.Vector.magnitude(TARGET_VECTOR);
+ // DIST - mob[i].radius < this.range &&
+ if (DIST < closeDist && Matter.Query.ray(map, this.position, mob[i].position).length === 0) {
+ closeDist = DIST;
+ this.lockedOn = mob[i]
+ }
+ }
+ }
+
+ const distanceToPlayer = Matter.Vector.magnitude(Matter.Vector.sub(this.position, mech.pos))
+ if (this.lockedOn) { //accelerate towards mobs
+ this.force = Matter.Vector.mult(Matter.Vector.normalise(Matter.Vector.sub(this.position, this.lockedOn.position)), -this.mass * THRUST)
+ this.frictionAir = 0.06
+ } else if (distanceToPlayer > 100) {
+ this.force = Matter.Vector.mult(Matter.Vector.normalise(Matter.Vector.sub(this.position, mech.pos)), -this.mass * THRUST * 0.3)
+ this.frictionAir = 0.02
+ } else { //must be close to player //add some random motion
+ this.frictionAir = 0
+ }
+ }
+ })
+ b.fireProps(mech.crouch ? 5 : 10, 15, dir, me); //cd , speed
+ b.drawOneBullet(bullet[me].vertices);
+ }
},
// {
// name: "dwarf star", //14
@@ -1820,78 +1895,5 @@ const b = {
// }
// },
// {
- // //draw a halo, since there will only be 1-3 balls
- // name: "junk-bots", //14
- // description: "release unreliable drones that defend the space around the player
collisions may cause malfunction",
- // ammo: 0,
- // ammoPack: 15,
- // have: false,
- // isStarterGun: false,
- // fire() {
- // const THRUST = 0.004
- // const dir = mech.angle + 0.2 * (Math.random() - 0.5);
- // const me = bullet.length;
- // const RADIUS = (15 + 8 * Math.random()) * b.modBulletSize
- // const LENGTH = 0.6 + 0.8 * Math.random()
-
- // bullet[me] = Bodies.rectangle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), RADIUS * LENGTH, RADIUS / LENGTH, {
- // isOrb: true,
- // angle: dir,
- // // inertia: Infinity,
- // // friction: 0,
- // density: 0.001, //normal is 0.001
- // frictionAir: 0.06,
- // restitution: 0.8,
- // dmg: b.modExtraDmg, // 0.14 //damage done in addition to the damage from momentum
- // minDmgSpeed: 2,
- // lookFrequency: 7 + Math.floor(17 * Math.random()),
- // endCycle: game.cycle + Math.floor((200 + 60 * Math.random()) * b.isModBulletsLastLonger),
- // classType: "bullet",
- // collisionFilter: {
- // category: 0x000100,
- // mask: 0x010111 //self, mob,map,body collide
- // },
- // range: 300,
- // lockedOn: null,
- // onDmg() {
- // this.lockedOn = null
- // // this.endCycle -= 120; //lose 2 seconds after damage is done
- // },
- // onEnd() {},
- // do() {
- // if (game.cycle + 120 > this.endCycle) { //fall and die
- // this.force.y += this.mass * 0.0012;
- // } else {
- // if (!(game.cycle % this.lookFrequency)) {
- // this.lockedOn = null;
- // let closeDist = Infinity;
- // for (let i = 0, len = mob.length; i < len; ++i) {
- // const TARGET_VECTOR = Matter.Vector.sub(mech.pos, mob[i].position)
- // const DIST = Matter.Vector.magnitude(TARGET_VECTOR);
- // // DIST - mob[i].radius < this.range &&
- // if (DIST < closeDist && Matter.Query.ray(map, this.position, mob[i].position).length === 0) {
- // closeDist = DIST;
- // this.lockedOn = mob[i]
- // }
- // }
- // }
-
- // const distanceToPlayer = Matter.Vector.magnitude(Matter.Vector.sub(this.position, mech.pos))
- // if (this.lockedOn) { //accelerate towards mobs
- // this.force = Matter.Vector.mult(Matter.Vector.normalise(Matter.Vector.sub(this.position, this.lockedOn.position)), -this.mass * THRUST)
- // this.frictionAir = 0.06
- // } else if (distanceToPlayer > 100) {
- // this.force = Matter.Vector.mult(Matter.Vector.normalise(Matter.Vector.sub(this.position, mech.pos)), -this.mass * THRUST * 0.3)
- // this.frictionAir = 0.02
- // } else { //must be close to player //add some random motion
- // this.frictionAir = 0
- // }
- // }
- // }
- // })
- // b.fireProps(mech.crouch ? 5 : 10, 15, dir, me); //cd , speed
- // b.drawOneBullet(bullet[me].vertices);
- // }
- // },
]
};
\ No newline at end of file
diff --git a/js/engine.js b/js/engine.js
index 511101a..9d5ab2b 100644
--- a/js/engine.js
+++ b/js/engine.js
@@ -34,10 +34,10 @@ function playerOnGroundCheck(event) {
let pair = pairs[i];
if (pair.bodyA === jumpSensor) {
mech.standingOn = pair.bodyB; //keeping track to correctly provide recoil on jump
- enter();
+ if (mech.standingOn.alive !== true) enter();
} else if (pair.bodyB === jumpSensor) {
mech.standingOn = pair.bodyA; //keeping track to correctly provide recoil on jump
- enter();
+ if (mech.standingOn.alive !== true) enter();
}
}
mech.numTouching = 0;
diff --git a/js/level.js b/js/level.js
index a66d8b3..0c69a98 100644
--- a/js/level.js
+++ b/js/level.js
@@ -16,7 +16,7 @@ const level = {
// game.difficulty = 6; //for testing to simulate possible mobs spawns
// b.giveGuns(1)
// mech.fieldUpgrades[2].effect();
- // b.giveMod(13)
+ // b.giveMod(5)
// spawn.pickList = ["ghoster", "ghoster"]
this.intro(); //starting level
@@ -50,6 +50,7 @@ const level = {
difficultyDecrease(num = 1) { //used in easy mode for game.reset()
for (let i = 0; i < num; i++) {
game.dmgScale -= 0.2; //damage done by mobs increases each level
+ if (game.dmgScale < 0.1) game.dmgScale = 0.1;
b.dmgScale /= 0.95; //damage done by player decreases each level
game.accelScale /= 1.05 //mob acceleration increases each level
game.lookFreqScale /= 0.95 //mob cycles between looks decreases each level
@@ -684,7 +685,10 @@ const level = {
spawn.mapRect(4700, -2910, 100, 510);
spawn.mapRect(3700, -2600, 300, 50);
spawn.mapRect(4100, -2900, 900, 50);
- spawn.mapRect(3450, -2300, 1650, 100);
+ spawn.mapRect(3450, -2300, 750, 100);
+ spawn.mapRect(4300, -2300, 750, 100);
+ spawn.mapRect(4150, -1600, 200, 25);
+ spawn.mapRect(4150, -700, 200, 25);
//exit room on top of tower
spawn.mapRect(3700, -3700, 600, 50);
spawn.mapRect(3700, -3700, 50, 500);
diff --git a/js/mobs.js b/js/mobs.js
index 75f04da..3b4c630 100644
--- a/js/mobs.js
+++ b/js/mobs.js
@@ -231,22 +231,25 @@ const mobs = {
// ctx.lineDashOffset = 6*(game.cycle % 215);
if (this.distanceToPlayer() < this.laserRange) {
//if (Math.random()>0.2 && this.seePlayer.yes && this.distanceToPlayer2()<800000) {
- if (!b.isModAoEImmunity) {
+ if (b.isModTempResist) {
+ mech.damage(0.00006 * game.dmgScale);
+ } else {
mech.damage(0.0003 * game.dmgScale);
- if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.005
- ctx.beginPath();
- ctx.moveTo(this.position.x, this.position.y);
- ctx.lineTo(mech.pos.x, mech.pos.y);
- ctx.lineTo(mech.pos.x + (Math.random() - 0.5) * 3000, mech.pos.y + (Math.random() - 0.5) * 3000);
- ctx.lineWidth = 2;
- ctx.strokeStyle = "rgb(255,0,170)";
- ctx.stroke();
-
- ctx.beginPath();
- ctx.arc(mech.pos.x, mech.pos.y, 40, 0, 2 * Math.PI);
- ctx.fillStyle = "rgba(255,0,170,0.15)";
- ctx.fill();
}
+ if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.004
+ ctx.beginPath();
+ ctx.moveTo(this.position.x, this.position.y);
+ ctx.lineTo(mech.pos.x, mech.pos.y);
+ ctx.lineTo(mech.pos.x + (Math.random() - 0.5) * 3000, mech.pos.y + (Math.random() - 0.5) * 3000);
+ ctx.lineWidth = 2;
+ ctx.strokeStyle = "rgb(255,0,170)";
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.arc(mech.pos.x, mech.pos.y, 40, 0, 2 * Math.PI);
+ ctx.fillStyle = "rgba(255,0,170,0.15)";
+ ctx.fill();
+
}
ctx.beginPath();
ctx.arc(this.position.x, this.position.y, this.laserRange * 0.9, 0, 2 * Math.PI);
@@ -320,7 +323,12 @@ const mobs = {
vertexCollision(this.position, look, [player]);
// hitting player
if (best.who === player) {
- dmg = 0.004 * game.dmgScale;
+ if (b.isModTempResist) {
+ dmg = 0.0008 * game.dmgScale;
+ } else {
+ dmg = 0.004 * game.dmgScale;
+ }
+
mech.damage(dmg);
//draw damage
ctx.fillStyle = color;
diff --git a/js/spawn.js b/js/spawn.js
index b378099..c146b2e 100644
--- a/js/spawn.js
+++ b/js/spawn.js
@@ -456,9 +456,10 @@ const spawn = {
this.healthBar();
//when player is inside event horizon
- if (Matter.Vector.magnitude(Matter.Vector.sub(this.position, player.position)) < eventHorizon && !b.isModAoEImmunity) {
+ if (Matter.Vector.magnitude(Matter.Vector.sub(this.position, player.position)) < eventHorizon) {
mech.damage(0.00015 * game.dmgScale);
- if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.01
+ if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.007
+
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= 1.25 * Math.cos(angle) * player.mass * game.g * (mech.onGround ? 1.8 : 1);
player.force.y -= 0.96 * player.mass * game.g * Math.sin(angle);
@@ -545,9 +546,9 @@ const spawn = {
ctx.fillStyle = "rgba(0,0,0,0.05)";
ctx.fill();
//when player is inside event horizon
- if (Matter.Vector.magnitude(Matter.Vector.sub(this.position, player.position)) < eventHorizon && !b.isModAoEImmunity) {
+ if (Matter.Vector.magnitude(Matter.Vector.sub(this.position, player.position)) < eventHorizon) {
mech.damage(0.00015 * game.dmgScale);
- if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.01
+ if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.007
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= 1.3 * Math.cos(angle) * player.mass * game.g * (mech.onGround ? 1.7 : 1);
player.force.y -= 1.2 * Math.sin(angle) * player.mass * game.g;