hammer + nail
pneumatic hammer (20 -> +18% size and damage effects) now applies to nails, slugs, needles, in addition to rivets integrated armament 20->25% damage, also if you switch guns converts guntech to new gun backward induction removed symbiosis removes 1 -> 0.5 max health per mob kill plasma jet - costs 1 -> 2 research, and goes a bit farther Occam's razor gives 36 -> 40% damage per removed tech
This commit is contained in:
169
js/bullet.js
169
js/bullet.js
@@ -157,6 +157,39 @@ const b = {
|
|||||||
}
|
}
|
||||||
simulation.makeGunHUD();
|
simulation.makeGunHUD();
|
||||||
b.setFireCD();
|
b.setFireCD();
|
||||||
|
if (tech.isOneGun && b.inventory > 0) {
|
||||||
|
//count how many gun tech you have and remove them
|
||||||
|
let gunTechCount = 0 //2 bonus gun tech
|
||||||
|
for (let i = 0, len = tech.tech.length; i < len; i++) {
|
||||||
|
if (tech.tech[i].isGunTech && tech.tech[i].count > 0 && !tech.tech[i].isNonRefundable && !tech.tech[i].isRemoveGun) {
|
||||||
|
const remove = tech.removeTech(i)
|
||||||
|
// console.log(remove, tech.tech[i].count, tech.tech[i].name)
|
||||||
|
gunTechCount += remove
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// console.log(gunTechCount)
|
||||||
|
|
||||||
|
//get a random gun tech for your gun
|
||||||
|
for (let i = 0; i < gunTechCount; i++) {
|
||||||
|
const gunTechPool = []
|
||||||
|
for (let j = 0, len = tech.tech.length; j < len; j++) {
|
||||||
|
if (tech.tech[j].isGunTech && tech.tech[j].allowed() && !tech.tech[i].isRemoveGun && !tech.tech[j].isJunk && !tech.tech[j].isBadRandomOption && tech.tech[j].count < tech.tech[j].maxCount) {
|
||||||
|
const regex = tech.tech[j].requires.search(b.guns[b.activeGun].name) //get string index of gun name
|
||||||
|
const not = tech.tech[j].requires.search(' not ') //get string index of ' not '
|
||||||
|
//look for the gun name in the requirements, but the gun name needs to show up before the word ' not '
|
||||||
|
if (regex !== -1 && (not === -1 || not > regex)) gunTechPool.push(j)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gunTechPool.length) {
|
||||||
|
const index = Math.floor(Math.random() * gunTechPool.length)
|
||||||
|
tech.giveTech(gunTechPool[index]) // choose from the gun pool
|
||||||
|
simulation.makeTextLog(`<span class='color-var'>tech</span>.giveTech("<span class='color-text'>${tech.tech[gunTechPool[index]].name}</span>")`)
|
||||||
|
} else {
|
||||||
|
tech.giveTech() //get normal tech if you can't find any gun tech
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
removeGun(gun, isRemoveSelection = false) {
|
removeGun(gun, isRemoveSelection = false) {
|
||||||
for (let i = 0; i < b.guns.length; i++) {
|
for (let i = 0; i < b.guns.length; i++) {
|
||||||
@@ -1111,7 +1144,7 @@ const b = {
|
|||||||
b.guns[gunIndex].do = function() {}
|
b.guns[gunIndex].do = function() {}
|
||||||
} else {
|
} else {
|
||||||
if (gunIndex) b.guns[gunIndex].do = function() {
|
if (gunIndex) b.guns[gunIndex].do = function() {
|
||||||
if (!input.field) {
|
if (!input.field && input.down) {
|
||||||
const cycles = 80
|
const cycles = 80
|
||||||
const speed = input.down ? 35 : 20 //input.down ? 43 : 32
|
const speed = input.down ? 35 : 20 //input.down ? 43 : 32
|
||||||
const g = input.down ? 0.137 : 0.135
|
const g = input.down ? 0.137 : 0.135
|
||||||
@@ -1137,7 +1170,7 @@ const b = {
|
|||||||
} else if (tech.isVacuumBomb) {
|
} else if (tech.isVacuumBomb) {
|
||||||
b.grenade = grenadeVacuum
|
b.grenade = grenadeVacuum
|
||||||
if (gunIndex) b.guns[gunIndex].do = function() {
|
if (gunIndex) b.guns[gunIndex].do = function() {
|
||||||
if (!input.field) {
|
if (!input.field && input.down) {
|
||||||
const cycles = Math.floor(input.down ? 50 : 30) //30
|
const cycles = Math.floor(input.down ? 50 : 30) //30
|
||||||
const speed = input.down ? 44 : 35
|
const speed = input.down ? 44 : 35
|
||||||
const v = { x: speed * Math.cos(m.angle), y: speed * Math.sin(m.angle) }
|
const v = { x: speed * Math.cos(m.angle), y: speed * Math.sin(m.angle) }
|
||||||
@@ -1154,7 +1187,7 @@ const b = {
|
|||||||
} else {
|
} else {
|
||||||
b.grenade = grenadeDefault
|
b.grenade = grenadeDefault
|
||||||
if (gunIndex) b.guns[gunIndex].do = function() {
|
if (gunIndex) b.guns[gunIndex].do = function() {
|
||||||
if (!input.field) {
|
if (!input.field && input.down) {
|
||||||
const cycles = Math.floor(input.down ? 120 : 80) //30
|
const cycles = Math.floor(input.down ? 120 : 80) //30
|
||||||
const speed = input.down ? 43 : 32
|
const speed = input.down ? 43 : 32
|
||||||
const v = { x: speed * Math.cos(m.angle), y: speed * Math.sin(m.angle) } //m.Vy / 2 + removed to make the path less jerky
|
const v = { x: speed * Math.cos(m.angle), y: speed * Math.sin(m.angle) } //m.Vy / 2 + removed to make the path less jerky
|
||||||
@@ -1738,7 +1771,7 @@ const b = {
|
|||||||
m.energy = 0;
|
m.energy = 0;
|
||||||
}
|
}
|
||||||
b.isExtruderOn = true
|
b.isExtruderOn = true
|
||||||
const SPEED = 8 + 8 * tech.isPlasmaRange
|
const SPEED = 8 + 12 * tech.isPlasmaRange
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
const where = Vector.add(m.pos, player.velocity)
|
const where = Vector.add(m.pos, player.velocity)
|
||||||
bullet[me] = Bodies.polygon(where.x + 20 * Math.cos(m.angle), where.y + 20 * Math.sin(m.angle), 4, 0.01, {
|
bullet[me] = Bodies.polygon(where.x + 20 * Math.cos(m.angle), where.y + 20 * Math.sin(m.angle), 4, 0.01, {
|
||||||
@@ -3253,8 +3286,9 @@ const b = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
nail(pos, velocity, dmg = 1) {
|
nail(pos, velocity, dmg = 1) {
|
||||||
|
dmg *= tech.nailSize
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
bullet[me] = Bodies.rectangle(pos.x, pos.y, 25, 2, b.fireAttributes(Math.atan2(velocity.y, velocity.x)));
|
bullet[me] = Bodies.rectangle(pos.x, pos.y, 25 * tech.nailSize, 2 * tech.nailSize, b.fireAttributes(Math.atan2(velocity.y, velocity.x)));
|
||||||
Matter.Body.setVelocity(bullet[me], velocity);
|
Matter.Body.setVelocity(bullet[me], velocity);
|
||||||
Composite.add(engine.world, bullet[me]); //add bullet to world
|
Composite.add(engine.world, bullet[me]); //add bullet to world
|
||||||
bullet[me].endCycle = simulation.cycle + 60 + 18 * Math.random();
|
bullet[me].endCycle = simulation.cycle + 60 + 18 * Math.random();
|
||||||
@@ -3269,7 +3303,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
needle(angle = m.angle) {
|
needle(angle = m.angle) {
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
bullet[me] = Bodies.rectangle(m.pos.x + 40 * Math.cos(m.angle), m.pos.y + 40 * Math.sin(m.angle), 75, 0.75, b.fireAttributes(angle));
|
bullet[me] = Bodies.rectangle(m.pos.x + 40 * Math.cos(m.angle), m.pos.y + 40 * Math.sin(m.angle), 75 * tech.nailSize, 0.75 * tech.nailSize, b.fireAttributes(angle));
|
||||||
bullet[me].collisionFilter.mask = tech.isShieldPierce ? cat.body : cat.body | cat.mobShield
|
bullet[me].collisionFilter.mask = tech.isShieldPierce ? cat.body : cat.body | cat.mobShield
|
||||||
Matter.Body.setDensity(bullet[me], 0.00001); //0.001 is normal
|
Matter.Body.setDensity(bullet[me], 0.00001); //0.001 is normal
|
||||||
bullet[me].endCycle = simulation.cycle + 100;
|
bullet[me].endCycle = simulation.cycle + 100;
|
||||||
@@ -3289,12 +3323,12 @@ const b = {
|
|||||||
}
|
}
|
||||||
if (!immune) {
|
if (!immune) {
|
||||||
if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.94) {
|
if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.94) {
|
||||||
b.explosion(this.position, 220 + 50 * Math.random()); //makes bullet do explosive damage at end
|
b.explosion(this.position, 220 * tech.nailSize + 50 * Math.random()); //makes bullet do explosive damage at end
|
||||||
}
|
}
|
||||||
this.immuneList.push(who.id) //remember that this needle has hit this mob once already
|
this.immuneList.push(who.id) //remember that this needle has hit this mob once already
|
||||||
let dmg = b.dmgScale * 6
|
let dmg = b.dmgScale * 6 * tech.nailSize
|
||||||
if (tech.isNailRadiation) {
|
if (tech.isNailRadiation) {
|
||||||
mobs.statusDoT(who, tech.isFastRadiation ? 6 : 2, tech.isSlowRadiation ? 360 : (tech.isFastRadiation ? 60 : 180)) // one tick every 30 cycles
|
mobs.statusDoT(who, (tech.isFastRadiation ? 6 : 2) * tech.nailSize, tech.isSlowRadiation ? 360 : (tech.isFastRadiation ? 60 : 180)) // one tick every 30 cycles
|
||||||
dmg *= 0.25
|
dmg *= 0.25
|
||||||
}
|
}
|
||||||
if (tech.isCrit && who.isStunned) dmg *= 4
|
if (tech.isCrit && who.isStunned) dmg *= 4
|
||||||
@@ -4364,7 +4398,7 @@ const b = {
|
|||||||
m.fireCDcycle = m.cycle + Math.floor((input.down ? 25 : 17) * b.fireCDscale); // cool down
|
m.fireCDcycle = m.cycle + Math.floor((input.down ? 25 : 17) * b.fireCDscale); // cool down
|
||||||
|
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
const size = tech.rivetSize * 8
|
const size = tech.nailSize * 8
|
||||||
bullet[me] = Bodies.rectangle(m.pos.x + 35 * Math.cos(m.angle), m.pos.y + 35 * Math.sin(m.angle), 5 * size, size, b.fireAttributes(m.angle));
|
bullet[me] = Bodies.rectangle(m.pos.x + 35 * Math.cos(m.angle), m.pos.y + 35 * Math.sin(m.angle), 5 * size, size, b.fireAttributes(m.angle));
|
||||||
bullet[me].dmg = tech.isNailRadiation ? 0 : 2.75
|
bullet[me].dmg = tech.isNailRadiation ? 0 : 2.75
|
||||||
Matter.Body.setDensity(bullet[me], 0.002);
|
Matter.Body.setDensity(bullet[me], 0.002);
|
||||||
@@ -4427,7 +4461,7 @@ const b = {
|
|||||||
m.fireCDcycle = m.cycle + Math.floor(CD * b.fireCDscale); // cool down
|
m.fireCDcycle = m.cycle + Math.floor(CD * b.fireCDscale); // cool down
|
||||||
|
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
const size = tech.rivetSize * 8
|
const size = tech.nailSize * 8
|
||||||
bullet[me] = Bodies.rectangle(m.pos.x + 35 * Math.cos(m.angle), m.pos.y + 35 * Math.sin(m.angle), 5 * size, size, b.fireAttributes(m.angle));
|
bullet[me] = Bodies.rectangle(m.pos.x + 35 * Math.cos(m.angle), m.pos.y + 35 * Math.sin(m.angle), 5 * size, size, b.fireAttributes(m.angle));
|
||||||
bullet[me].dmg = tech.isNailRadiation ? 0 : 2.75
|
bullet[me].dmg = tech.isNailRadiation ? 0 : 2.75
|
||||||
Matter.Body.setDensity(bullet[me], 0.002);
|
Matter.Body.setDensity(bullet[me], 0.002);
|
||||||
@@ -4557,15 +4591,15 @@ const b = {
|
|||||||
|
|
||||||
if (tech.isSlugShot) {
|
if (tech.isSlugShot) {
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
const dir = m.angle + 0.02 * (Math.random() - 0.5)
|
// const dir = m.angle + 0.02 * (Math.random() - 0.5)
|
||||||
bullet[me] = Bodies.rectangle(m.pos.x + 35 * Math.cos(m.angle), m.pos.y + 35 * Math.sin(m.angle), 60, 27, b.fireAttributes(dir));
|
bullet[me] = Bodies.rectangle(m.pos.x + 35 * Math.cos(m.angle), m.pos.y + 35 * Math.sin(m.angle), 60 * tech.nailSize, 27 * tech.nailSize, b.fireAttributes(m.angle));
|
||||||
|
|
||||||
Matter.Body.setDensity(bullet[me], 0.007 * (tech.isShotgunReversed ? 1.6 : 1));
|
Matter.Body.setDensity(bullet[me], 0.007 * (tech.isShotgunReversed ? 1.6 : 1));
|
||||||
Composite.add(engine.world, bullet[me]); //add bullet to world
|
Composite.add(engine.world, bullet[me]); //add bullet to world
|
||||||
const SPEED = (input.down ? 45 : 35) + Math.random() * 6
|
const SPEED = (input.down ? 50 : 37)
|
||||||
Matter.Body.setVelocity(bullet[me], {
|
Matter.Body.setVelocity(bullet[me], {
|
||||||
x: SPEED * Math.cos(dir),
|
x: SPEED * Math.cos(m.angle),
|
||||||
y: SPEED * Math.sin(dir)
|
y: SPEED * Math.sin(m.angle)
|
||||||
});
|
});
|
||||||
if (tech.isIncendiary) {
|
if (tech.isIncendiary) {
|
||||||
bullet[me].endCycle = simulation.cycle + 60
|
bullet[me].endCycle = simulation.cycle + 60
|
||||||
@@ -4581,27 +4615,22 @@ const b = {
|
|||||||
bullet[me].minDmgSpeed = 7
|
bullet[me].minDmgSpeed = 7
|
||||||
// bullet[me].restitution = 0.4
|
// bullet[me].restitution = 0.4
|
||||||
bullet[me].frictionAir = 0.006;
|
bullet[me].frictionAir = 0.006;
|
||||||
|
bullet[me].turnMag = 0.04 * Math.pow(tech.nailSize, 3.75)
|
||||||
bullet[me].do = function() {
|
bullet[me].do = function() {
|
||||||
this.force.y += this.mass * 0.0022
|
this.force.y += this.mass * 0.0022
|
||||||
|
if (this.speed > 6) { //rotates bullet to face current velocity?
|
||||||
//rotates bullet to face current velocity?
|
const facing = { x: Math.cos(this.angle), y: Math.sin(this.angle) }
|
||||||
if (this.speed > 6) {
|
|
||||||
const facing = {
|
|
||||||
x: Math.cos(this.angle),
|
|
||||||
y: Math.sin(this.angle)
|
|
||||||
}
|
|
||||||
const mag = 0.04
|
|
||||||
if (Vector.cross(Vector.normalise(this.velocity), facing) < 0) {
|
if (Vector.cross(Vector.normalise(this.velocity), facing) < 0) {
|
||||||
this.torque += mag
|
this.torque += this.turnMag
|
||||||
} else {
|
} else {
|
||||||
this.torque -= mag
|
this.torque -= this.turnMag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (tech.fragments) {
|
if (tech.fragments) {
|
||||||
bullet[me].beforeDmg = function() {
|
bullet[me].beforeDmg = function() {
|
||||||
if (this.speed > 4) {
|
if (this.speed > 4) {
|
||||||
b.targetedNail(this.position, tech.fragments * 7)
|
b.targetedNail(this.position, 7 * tech.fragments * tech.nailSize)
|
||||||
this.endCycle = 0 //triggers despawn
|
this.endCycle = 0 //triggers despawn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6507,47 +6536,47 @@ const b = {
|
|||||||
// },
|
// },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gunRewind: { //this gun is added with a tech
|
// gunRewind: { //this gun is added with a tech
|
||||||
name: "CPT gun",
|
// name: "CPT gun",
|
||||||
description: "use <strong class='color-f'>energy</strong> to <strong>rewind</strong> your <strong class='color-h'>health</strong>, <strong>velocity</strong>,<br> and <strong>position</strong> up to <strong>10</strong> seconds",
|
// description: "use <strong class='color-f'>energy</strong> to <strong>rewind</strong> your <strong class='color-h'>health</strong>, <strong>velocity</strong>,<br> and <strong>position</strong> up to <strong>10</strong> seconds",
|
||||||
ammo: 0,
|
// ammo: 0,
|
||||||
ammoPack: Infinity,
|
// ammoPack: Infinity,
|
||||||
have: false,
|
// have: false,
|
||||||
isRewinding: false,
|
// isRewinding: false,
|
||||||
lastFireCycle: 0,
|
// lastFireCycle: 0,
|
||||||
holdCount: 0,
|
// holdCount: 0,
|
||||||
activeGunIndex: null,
|
// activeGunIndex: null,
|
||||||
do() {},
|
// do() {},
|
||||||
fire() {
|
// fire() {
|
||||||
if (this.lastFireCycle === m.cycle - 1) { //button has been held down
|
// if (this.lastFireCycle === m.cycle - 1) { //button has been held down
|
||||||
this.rewindCount += 8;
|
// this.rewindCount += 8;
|
||||||
const DRAIN = 0.01
|
// const DRAIN = 0.01
|
||||||
let history = m.history[(m.cycle - this.rewindCount) % 600]
|
// let history = m.history[(m.cycle - this.rewindCount) % 600]
|
||||||
if (this.rewindCount > 599 || m.energy < DRAIN || history.activeGun !== this.activeGunIndex) {
|
// if (this.rewindCount > 599 || m.energy < DRAIN || history.activeGun !== this.activeGunIndex) {
|
||||||
this.rewindCount = 0;
|
// this.rewindCount = 0;
|
||||||
m.resetHistory();
|
// m.resetHistory();
|
||||||
m.fireCDcycle = m.cycle + Math.floor(120 * b.fireCDscale); // cool down
|
// m.fireCDcycle = m.cycle + Math.floor(120 * b.fireCDscale); // cool down
|
||||||
} else {
|
// } else {
|
||||||
m.energy -= DRAIN
|
// m.energy -= DRAIN
|
||||||
if (m.immuneCycle < m.cycle + 30) m.immuneCycle = m.cycle + 30; //player is immune to damage for 5 cycles
|
// if (m.immuneCycle < m.cycle + 30) m.immuneCycle = m.cycle + 30; //player is immune to damage for 5 cycles
|
||||||
Matter.Body.setPosition(player, history.position);
|
// Matter.Body.setPosition(player, history.position);
|
||||||
Matter.Body.setVelocity(player, { x: history.velocity.x, y: history.velocity.y });
|
// Matter.Body.setVelocity(player, { x: history.velocity.x, y: history.velocity.y });
|
||||||
if (m.health !== history.health) {
|
// if (m.health !== history.health) {
|
||||||
m.health = history.health
|
// m.health = history.health
|
||||||
m.displayHealth();
|
// m.displayHealth();
|
||||||
}
|
// }
|
||||||
m.yOff = history.yOff
|
// m.yOff = history.yOff
|
||||||
if (m.yOff < 48) {
|
// if (m.yOff < 48) {
|
||||||
m.doCrouch()
|
// m.doCrouch()
|
||||||
} else {
|
// } else {
|
||||||
m.undoCrouch()
|
// m.undoCrouch()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else { //button is held the first time
|
// } else { //button is held the first time
|
||||||
this.rewindCount = 0;
|
// this.rewindCount = 0;
|
||||||
this.activeGunIndex = b.activeGun
|
// this.activeGunIndex = b.activeGun
|
||||||
}
|
// }
|
||||||
this.lastFireCycle = m.cycle;
|
// this.lastFireCycle = m.cycle;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
@@ -232,15 +232,15 @@ function collisionChecks(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//determine if player is on the ground
|
//determine if player is on the ground
|
||||||
Events.on(engine, "collisionStart", function (event) {
|
Events.on(engine, "collisionStart", function(event) {
|
||||||
playerOnGroundCheck(event);
|
playerOnGroundCheck(event);
|
||||||
// playerHeadCheck(event);
|
// playerHeadCheck(event);
|
||||||
if (m.alive) collisionChecks(event);
|
if (m.alive) collisionChecks(event);
|
||||||
});
|
});
|
||||||
Events.on(engine, "collisionActive", function (event) {
|
Events.on(engine, "collisionActive", function(event) {
|
||||||
playerOnGroundCheck(event);
|
playerOnGroundCheck(event);
|
||||||
// playerHeadCheck(event);
|
// playerHeadCheck(event);
|
||||||
});
|
});
|
||||||
Events.on(engine, "collisionEnd", function (event) {
|
Events.on(engine, "collisionEnd", function(event) {
|
||||||
playerOffGroundCheck(event);
|
playerOffGroundCheck(event);
|
||||||
});
|
});
|
||||||
41
js/level.js
41
js/level.js
@@ -17,10 +17,10 @@ const level = {
|
|||||||
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
|
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
|
||||||
// simulation.isHorizontalFlipped = true
|
// simulation.isHorizontalFlipped = true
|
||||||
// m.setField("wormhole")
|
// m.setField("wormhole")
|
||||||
// b.giveGuns("laser")
|
// b.giveGuns("shotgun")
|
||||||
// b.giveGuns("nail gun")
|
// b.giveGuns("nail gun")
|
||||||
// b.giveGuns("harpoon")
|
// b.giveGuns("harpoon")
|
||||||
// tech.giveTech("affine connection")
|
// tech.giveTech("slug")
|
||||||
// tech.giveTech("regression")
|
// tech.giveTech("regression")
|
||||||
// tech.giveTech("relativistic momentum")
|
// tech.giveTech("relativistic momentum")
|
||||||
// for (let i = 0; i < 2; i++) tech.giveTech("refractory metal")
|
// for (let i = 0; i < 2; i++) tech.giveTech("refractory metal")
|
||||||
@@ -58,7 +58,6 @@ const level = {
|
|||||||
// for (let i = 0; i < 30; i++) powerUps.spawn(player.position.x + Math.random() * 50, player.position.y - Math.random() * 50, "tech", false);
|
// for (let i = 0; i < 30; i++) powerUps.spawn(player.position.x + Math.random() * 50, player.position.y - Math.random() * 50, "tech", false);
|
||||||
// for (let i = 0; i < 3; i++) tech.giveTech("undefined")
|
// for (let i = 0; i < 3; i++) tech.giveTech("undefined")
|
||||||
// lore.techCount = 3
|
// lore.techCount = 3
|
||||||
|
|
||||||
// simulation.isCheating = false //true;
|
// simulation.isCheating = false //true;
|
||||||
// localSettings.loreCount = 3; //this sets what conversation is heard
|
// localSettings.loreCount = 3; //this sets what conversation is heard
|
||||||
// localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
// localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||||
@@ -131,8 +130,8 @@ const level = {
|
|||||||
// for (let i = 0; i < 2; i++) powerUps.spawn(player.position.x + 90 * (Math.random() - 0.5), player.position.y + 90 * (Math.random() - 0.5), "tech", false); //start
|
// for (let i = 0; i < 2; i++) powerUps.spawn(player.position.x + 90 * (Math.random() - 0.5), player.position.y + 90 * (Math.random() - 0.5), "tech", false); //start
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
custom() { },
|
custom() {},
|
||||||
customTopLayer() { },
|
customTopLayer() {},
|
||||||
setDifficulty() {
|
setDifficulty() {
|
||||||
simulation.difficulty = 0
|
simulation.difficulty = 0
|
||||||
b.dmgScale = 1; //damage done by player decreases each level
|
b.dmgScale = 1; //damage done by player decreases each level
|
||||||
@@ -574,7 +573,7 @@ const level = {
|
|||||||
body[body.length] = rotor1
|
body[body.length] = rotor1
|
||||||
body[body.length] = rotor2
|
body[body.length] = rotor2
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
rotor.collisionFilter.category = cat.body;
|
rotor.collisionFilter.category = cat.body;
|
||||||
rotor.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet //| cat.map
|
rotor.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet //| cat.map
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -589,7 +588,7 @@ const level = {
|
|||||||
Composite.add(engine.world, constraint);
|
Composite.add(engine.world, constraint);
|
||||||
|
|
||||||
if (rotate) {
|
if (rotate) {
|
||||||
rotor.rotate = function () {
|
rotor.rotate = function() {
|
||||||
if (!m.isBodiesAsleep) {
|
if (!m.isBodiesAsleep) {
|
||||||
Matter.Body.applyForce(rotor, {
|
Matter.Body.applyForce(rotor, {
|
||||||
x: rotor.position.x + 100,
|
x: rotor.position.x + 100,
|
||||||
@@ -792,7 +791,7 @@ const level = {
|
|||||||
y: 0
|
y: 0
|
||||||
}, angleB)
|
}, angleB)
|
||||||
|
|
||||||
draw = function () {
|
draw = function() {
|
||||||
ctx.beginPath(); //portal
|
ctx.beginPath(); //portal
|
||||||
let v = this.vertices;
|
let v = this.vertices;
|
||||||
ctx.moveTo(v[0].x, v[0].y);
|
ctx.moveTo(v[0].x, v[0].y);
|
||||||
@@ -802,7 +801,7 @@ const level = {
|
|||||||
ctx.fillStyle = this.color
|
ctx.fillStyle = this.color
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
}
|
}
|
||||||
query = function (isRemoveBlocks = false) {
|
query = function(isRemoveBlocks = false) {
|
||||||
if (Matter.Query.collides(this, [player]).length === 0) { //not touching player
|
if (Matter.Query.collides(this, [player]).length === 0) { //not touching player
|
||||||
if (player.isInPortal === this) player.isInPortal = null
|
if (player.isInPortal === this) player.isInPortal = null
|
||||||
} else if (player.isInPortal !== this) { //touching player
|
} else if (player.isInPortal !== this) { //touching player
|
||||||
@@ -1417,7 +1416,7 @@ const level = {
|
|||||||
button.isReadyToFire = true
|
button.isReadyToFire = true
|
||||||
} else if (button.isReadyToFire && !button.isUp) {
|
} else if (button.isReadyToFire && !button.isUp) {
|
||||||
button.isReadyToFire = false
|
button.isReadyToFire = false
|
||||||
fireBlock = function (xPos, yPos) {
|
fireBlock = function(xPos, yPos) {
|
||||||
const index = body.length
|
const index = body.length
|
||||||
spawn.bodyRect(xPos, yPos, 35 + 50 * Math.random(), 35 + 50 * Math.random());
|
spawn.bodyRect(xPos, yPos, 35 + 50 * Math.random(), 35 + 50 * Math.random());
|
||||||
const bodyBullet = body[body.length - 1]
|
const bodyBullet = body[body.length - 1]
|
||||||
@@ -1473,7 +1472,7 @@ const level = {
|
|||||||
button.isReadyToFire = true
|
button.isReadyToFire = true
|
||||||
} else if (button.isReadyToFire && !button.isUp) {
|
} else if (button.isReadyToFire && !button.isUp) {
|
||||||
button.isReadyToFire = false
|
button.isReadyToFire = false
|
||||||
fireBlock = function (xPos, yPos) {
|
fireBlock = function(xPos, yPos) {
|
||||||
const index = body.length
|
const index = body.length
|
||||||
spawn.bodyRect(xPos, yPos, 35 + 50 * Math.random(), 35 + 50 * Math.random());
|
spawn.bodyRect(xPos, yPos, 35 + 50 * Math.random(), 35 + 50 * Math.random());
|
||||||
const bodyBullet = body[body.length - 1]
|
const bodyBullet = body[body.length - 1]
|
||||||
@@ -2388,7 +2387,7 @@ const level = {
|
|||||||
level.exit.draw();
|
level.exit.draw();
|
||||||
level.enter.draw();
|
level.enter.draw();
|
||||||
};
|
};
|
||||||
level.customTopLayer = () => { };
|
level.customTopLayer = () => {};
|
||||||
level.setPosToSpawn(0, -50); //normal spawn
|
level.setPosToSpawn(0, -50); //normal spawn
|
||||||
level.exit.x = 1500;
|
level.exit.x = 1500;
|
||||||
level.exit.y = -1875;
|
level.exit.y = -1875;
|
||||||
@@ -5518,7 +5517,7 @@ const level = {
|
|||||||
if (mob[i].isBoss) me = mob[i]
|
if (mob[i].isBoss) me = mob[i]
|
||||||
}
|
}
|
||||||
if (me) {
|
if (me) {
|
||||||
me.onDeath = function () { //please don't edit the onDeath function this causes serious bugs
|
me.onDeath = function() { //please don't edit the onDeath function this causes serious bugs
|
||||||
spawnCouloirEnHaut()
|
spawnCouloirEnHaut()
|
||||||
doorSortieSalle.isOpen = false;
|
doorSortieSalle.isOpen = false;
|
||||||
};
|
};
|
||||||
@@ -5534,7 +5533,7 @@ const level = {
|
|||||||
if (mob[i].isBoss) me = mob[i]
|
if (mob[i].isBoss) me = mob[i]
|
||||||
}
|
}
|
||||||
if (me) {
|
if (me) {
|
||||||
me.onDeath = function () { //please don't edit the onDeath function this causes serious bugs
|
me.onDeath = function() { //please don't edit the onDeath function this causes serious bugs
|
||||||
spawnCouloirEnHaut()
|
spawnCouloirEnHaut()
|
||||||
doorSortieSalle.isOpen = false;
|
doorSortieSalle.isOpen = false;
|
||||||
};
|
};
|
||||||
@@ -5759,11 +5758,11 @@ const level = {
|
|||||||
body[body.length] = part4;
|
body[body.length] = part4;
|
||||||
body[body.length] = part5;
|
body[body.length] = part5;
|
||||||
body[body.length] = part6;
|
body[body.length] = part6;
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
chair.collisionFilter.category = cat.body;
|
chair.collisionFilter.category = cat.body;
|
||||||
chair.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
|
chair.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
|
||||||
}, 1000);
|
}, 1000);
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
chair2.collisionFilter.category = cat.body;
|
chair2.collisionFilter.category = cat.body;
|
||||||
chair2.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
|
chair2.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -5818,7 +5817,7 @@ const level = {
|
|||||||
body[body.length] = rightUpperLeg
|
body[body.length] = rightUpperLeg
|
||||||
body[body.length] = rightLowerArm
|
body[body.length] = rightLowerArm
|
||||||
body[body.length] = rightUpperArm
|
body[body.length] = rightUpperArm
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
person.collisionFilter.category = cat.body;
|
person.collisionFilter.category = cat.body;
|
||||||
person.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
|
person.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -6210,7 +6209,7 @@ const level = {
|
|||||||
level.exit.draw();
|
level.exit.draw();
|
||||||
level.enter.draw();
|
level.enter.draw();
|
||||||
};
|
};
|
||||||
level.customTopLayer = () => { };
|
level.customTopLayer = () => {};
|
||||||
level.defaultZoom = 1800
|
level.defaultZoom = 1800
|
||||||
simulation.zoomTransition(level.defaultZoom)
|
simulation.zoomTransition(level.defaultZoom)
|
||||||
document.body.style.backgroundColor = "#dcdcde";
|
document.body.style.backgroundColor = "#dcdcde";
|
||||||
@@ -7269,7 +7268,7 @@ const level = {
|
|||||||
body[body.length] = part1;
|
body[body.length] = part1;
|
||||||
body[body.length] = part2;
|
body[body.length] = part2;
|
||||||
body[body.length] = part3;
|
body[body.length] = part3;
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
compoundParts.collisionFilter.category = cat.body;
|
compoundParts.collisionFilter.category = cat.body;
|
||||||
compoundParts.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
|
compoundParts.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -7388,8 +7387,8 @@ const level = {
|
|||||||
|
|
||||||
// prevent the user from getting into the secreter room without defeating all mobs
|
// prevent the user from getting into the secreter room without defeating all mobs
|
||||||
if (m.pos.x > 1500 && m.pos.x < 2500 && m.pos.y > -4000 && m.pos.y < -3500 && mob.reduce((a, i) => {
|
if (m.pos.x > 1500 && m.pos.x < 2500 && m.pos.y > -4000 && m.pos.y < -3500 && mob.reduce((a, i) => {
|
||||||
return a || ((Math.sqrt((i.position.x - 3600) * (i.position.x - 3600) + (i.position.y + 3600) * (i.position.y + 3600)) < 20000) && i.isDropPowerUp);
|
return a || ((Math.sqrt((i.position.x - 3600) * (i.position.x - 3600) + (i.position.y + 3600) * (i.position.y + 3600)) < 20000) && i.isDropPowerUp);
|
||||||
}, false) && !emergencyActivated) {
|
}, false) && !emergencyActivated) {
|
||||||
Matter.Body.setPosition(player, {
|
Matter.Body.setPosition(player, {
|
||||||
x: 2800,
|
x: 2800,
|
||||||
y: m.pos.y
|
y: m.pos.y
|
||||||
|
|||||||
20
js/mob.js
20
js/mob.js
@@ -165,7 +165,7 @@ const mobs = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
endEffect() { },
|
endEffect() {},
|
||||||
dmg: tickDamage,
|
dmg: tickDamage,
|
||||||
type: "dot",
|
type: "dot",
|
||||||
endCycle: simulation.cycle + cycles,
|
endCycle: simulation.cycle + cycles,
|
||||||
@@ -472,7 +472,7 @@ const mobs = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
laser() {
|
laser() {
|
||||||
const vertexCollision = function (v1, v1End, domain) {
|
const vertexCollision = function(v1, v1End, domain) {
|
||||||
for (let i = 0; i < domain.length; ++i) {
|
for (let i = 0; i < domain.length; ++i) {
|
||||||
let vertices = domain[i].vertices;
|
let vertices = domain[i].vertices;
|
||||||
const len = vertices.length - 1;
|
const len = vertices.length - 1;
|
||||||
@@ -609,7 +609,7 @@ const mobs = {
|
|||||||
ctx.fillStyle = "rgba(0,0,0,0.07)";
|
ctx.fillStyle = "rgba(0,0,0,0.07)";
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
//spring to random place on map
|
//spring to random place on map
|
||||||
const vertexCollision = function (v1, v1End, domain) {
|
const vertexCollision = function(v1, v1End, domain) {
|
||||||
for (let i = 0; i < domain.length; ++i) {
|
for (let i = 0; i < domain.length; ++i) {
|
||||||
let vertices = domain[i].vertices;
|
let vertices = domain[i].vertices;
|
||||||
const len = vertices.length - 1;
|
const len = vertices.length - 1;
|
||||||
@@ -676,7 +676,7 @@ const mobs = {
|
|||||||
},
|
},
|
||||||
curl(range = 1000, mag = -10) {
|
curl(range = 1000, mag = -10) {
|
||||||
//cause all mobs, and bodies to rotate in a circle
|
//cause all mobs, and bodies to rotate in a circle
|
||||||
applyCurl = function (center, array, isAntiGravity = true) {
|
applyCurl = function(center, array, isAntiGravity = true) {
|
||||||
for (let i = 0; i < array.length; ++i) {
|
for (let i = 0; i < array.length; ++i) {
|
||||||
if (!array[i].isNotHoldable) {
|
if (!array[i].isNotHoldable) {
|
||||||
const sub = Vector.sub(center, array[i].position)
|
const sub = Vector.sub(center, array[i].position)
|
||||||
@@ -825,7 +825,7 @@ const mobs = {
|
|||||||
//be sure to declare searchTarget in mob spawn
|
//be sure to declare searchTarget in mob spawn
|
||||||
//accelerate towards the searchTarget
|
//accelerate towards the searchTarget
|
||||||
if (!this.seePlayer.recall) {
|
if (!this.seePlayer.recall) {
|
||||||
const newTarget = function (that) {
|
const newTarget = function(that) {
|
||||||
if (Math.random() < 0.0005) {
|
if (Math.random() < 0.0005) {
|
||||||
that.searchTarget = player.position; //chance to target player
|
that.searchTarget = player.position; //chance to target player
|
||||||
} else {
|
} else {
|
||||||
@@ -1149,7 +1149,7 @@ const mobs = {
|
|||||||
powerUps.spawn(this.position.x, this.position.y, "tech", false)
|
powerUps.spawn(this.position.x, this.position.y, "tech", false)
|
||||||
// if (0.5 < Math.random()) powerUps.spawn(this.position.x, this.position.y, "tech", false)
|
// if (0.5 < Math.random()) powerUps.spawn(this.position.x, this.position.y, "tech", false)
|
||||||
} else {
|
} else {
|
||||||
const amount = 0.01
|
const amount = 0.005
|
||||||
if (tech.isEnergyHealth) {
|
if (tech.isEnergyHealth) {
|
||||||
if (m.maxEnergy > amount) {
|
if (m.maxEnergy > amount) {
|
||||||
tech.healMaxEnergyBonus -= amount
|
tech.healMaxEnergyBonus -= amount
|
||||||
@@ -1228,7 +1228,7 @@ const mobs = {
|
|||||||
for (let i = 0, len = consBB.length; i < len; ++i) {
|
for (let i = 0, len = consBB.length; i < len; ++i) {
|
||||||
if (consBB[i].bodyA === this) {
|
if (consBB[i].bodyA === this) {
|
||||||
if (consBB[i].bodyB.shield) {
|
if (consBB[i].bodyB.shield) {
|
||||||
consBB[i].bodyB.do = function () {
|
consBB[i].bodyB.do = function() {
|
||||||
this.death();
|
this.death();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1238,7 +1238,7 @@ const mobs = {
|
|||||||
break;
|
break;
|
||||||
} else if (consBB[i].bodyB === this) {
|
} else if (consBB[i].bodyB === this) {
|
||||||
if (consBB[i].bodyA.shield) {
|
if (consBB[i].bodyA.shield) {
|
||||||
consBB[i].bodyA.do = function () {
|
consBB[i].bodyA.do = function() {
|
||||||
this.death();
|
this.death();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1297,7 +1297,7 @@ const mobs = {
|
|||||||
//large mobs shrink so they don't block paths
|
//large mobs shrink so they don't block paths
|
||||||
if (body[len].mass + body[len2].mass > 16) {
|
if (body[len].mass + body[len2].mass > 16) {
|
||||||
const massLimit = 8 + 6 * Math.random()
|
const massLimit = 8 + 6 * Math.random()
|
||||||
const shrink = function (that1, that2) {
|
const shrink = function(that1, that2) {
|
||||||
if (that1.mass + that2.mass > massLimit) {
|
if (that1.mass + that2.mass > massLimit) {
|
||||||
const scale = 0.95;
|
const scale = 0.95;
|
||||||
Matter.Body.scale(that1, scale, scale);
|
Matter.Body.scale(that1, scale, scale);
|
||||||
@@ -1320,7 +1320,7 @@ const mobs = {
|
|||||||
//large mobs shrink so they don't block paths
|
//large mobs shrink so they don't block paths
|
||||||
if (body[len].mass > 9) {
|
if (body[len].mass > 9) {
|
||||||
const massLimit = 7 + 4 * Math.random()
|
const massLimit = 7 + 4 * Math.random()
|
||||||
const shrink = function (that) {
|
const shrink = function(that) {
|
||||||
if (that.mass > massLimit) {
|
if (that.mass > massLimit) {
|
||||||
const scale = 0.95;
|
const scale = 0.95;
|
||||||
Matter.Body.scale(that, scale, scale);
|
Matter.Body.scale(that, scale, scale);
|
||||||
|
|||||||
3494
js/player.js
3494
js/player.js
File diff suppressed because it is too large
Load Diff
336
js/spawn.js
336
js/spawn.js
File diff suppressed because it is too large
Load Diff
16178
js/tech.js
16178
js/tech.js
File diff suppressed because it is too large
Load Diff
39
todo.txt
39
todo.txt
@@ -1,24 +1,35 @@
|
|||||||
******************************************************** NEXT PATCH **************************************************
|
******************************************************** NEXT PATCH **************************************************
|
||||||
|
|
||||||
tech: affine connection - wormholes can now tunnel through the map at 200% increased energy cost
|
pneumatic hammer (20 -> +18% size and damage effects)
|
||||||
tech: regression - after bullets hit a mob, the mob takes 5% more future damage (0.5% for bosses)
|
now applies to nails, slugs, needles, in addition to rivets
|
||||||
tech: axion - while inside the MACHO halo, 75% of your total harm reduction is added as damage
|
integrated armament 20->25% damage, also if you switch guns converts guntech to new gun
|
||||||
|
backward induction removed
|
||||||
mob: launcherOne - launches 1 big seeker bullet that chases you
|
symbiosis removes 1 -> 0.5 max health per mob kill
|
||||||
black holes boss and final boss spawn big seeker bullets that chases you during the black hole phase
|
plasma jet - costs 1 -> 2 research, and goes a bit farther
|
||||||
|
Occam's razor gives 36 -> 40% damage per removed tech
|
||||||
applied science no longer gives research (just a random tech for every gun you have)
|
|
||||||
bot fabrication increase cost every 5 -> x6 bots
|
|
||||||
|
|
||||||
average console time to disappear is 3 -> 4 seconds
|
|
||||||
ammo power ups no longer log ammo to in game console for performance reasons
|
|
||||||
|
|
||||||
JUNK tech: catabolysis - set max health to 1; double your current ammo 10 times (2^10 = 1024x ammo)
|
|
||||||
|
|
||||||
******************************************************** TODO ********************************************************
|
******************************************************** TODO ********************************************************
|
||||||
|
|
||||||
|
needle benefit from pneumatic hammer?
|
||||||
|
all nails?
|
||||||
|
|
||||||
|
total guntech:
|
||||||
|
nail gun needle @ 4
|
||||||
|
base nail gun @ 5
|
||||||
|
|
||||||
new late game level that is easier if you can: platform well, jump high, immune to slime, wormhole through walls, fly fast
|
new late game level that is easier if you can: platform well, jump high, immune to slime, wormhole through walls, fly fast
|
||||||
climb vertically to avoid rising slime
|
climb vertically to avoid rising slime
|
||||||
|
populate with multiple boss mobs that can't drop tech
|
||||||
|
bosses spawn in pairs
|
||||||
|
|
||||||
|
antimatter (assuming something else isn't already named this); requires negative mass, causes damage to self and enemies within range while active
|
||||||
|
|
||||||
|
increase mass and movement speed at the same time
|
||||||
|
increase jump differently because it scales extra with mass
|
||||||
|
m.defaultMass = 4.5
|
||||||
|
m.definePlayerMass()
|
||||||
|
|
||||||
|
give history boss legs?
|
||||||
|
|
||||||
field tech - disable blocking, but does high damage to mobs inside field
|
field tech - disable blocking, but does high damage to mobs inside field
|
||||||
and maybe slows mobs it damages
|
and maybe slows mobs it damages
|
||||||
|
|||||||
Reference in New Issue
Block a user