added chronon gun
This commit is contained in:
356
js/bullets.js
356
js/bullets.js
@@ -18,7 +18,7 @@ const b = {
|
|||||||
isModDroneOnDamage: null,
|
isModDroneOnDamage: null,
|
||||||
modExtraDmg: null,
|
modExtraDmg: null,
|
||||||
annihilation: null,
|
annihilation: null,
|
||||||
fullHeal: null,
|
isModFullHeal: null,
|
||||||
modSquirrelFx: null,
|
modSquirrelFx: null,
|
||||||
modIsCrit: null,
|
modIsCrit: null,
|
||||||
modMoreDrops: null,
|
modMoreDrops: null,
|
||||||
@@ -53,6 +53,7 @@ const b = {
|
|||||||
mech.jumpForce = 0.38;
|
mech.jumpForce = 0.38;
|
||||||
mech.throwChargeRate = 2;
|
mech.throwChargeRate = 2;
|
||||||
mech.throwChargeMax = 50;
|
mech.throwChargeMax = 50;
|
||||||
|
mech.maxHealth = 1;
|
||||||
for (let i = 0; i < b.mods.length; i++) {
|
for (let i = 0; i < b.mods.length; i++) {
|
||||||
b.mods[i].have = false;
|
b.mods[i].have = false;
|
||||||
}
|
}
|
||||||
@@ -67,87 +68,6 @@ const b = {
|
|||||||
b.modBulletSize = 1.1;
|
b.modBulletSize = 1.1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "auto-loading heuristics",
|
|
||||||
description: "your <strong>delay</strong> after firing is 15% <strong>shorter</strong>",
|
|
||||||
have: false, //1
|
|
||||||
effect: () => { //good for guns with extra ammo: needles, M80, rapid fire, flak, super balls
|
|
||||||
b.modFireRate = 0.85
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "desublimated ammunition",
|
|
||||||
description: "use 50% less <strong>ammo</strong> when <strong>crouching</strong>",
|
|
||||||
have: false, //2
|
|
||||||
effect: () => { //good with guns that have less ammo: one shot, grenades, missiles, super balls, spray
|
|
||||||
b.modNoAmmo = 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Lorentzian topology",
|
|
||||||
description: "your <strong>bullets</strong> last 40% <strong>longer</strong>",
|
|
||||||
have: false, //3
|
|
||||||
effect: () => { //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
|
||||||
b.isModBulletsLastLonger = 1.40
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "anti-matter cores",
|
|
||||||
description: "the <strong>radius</strong> of your <strong class='color-e'>explosions</strong> is doubled<br><strong style='opacity:0.3;'>be careful</strong>",
|
|
||||||
have: false, //4
|
|
||||||
effect: () => { //at 1.4 gives a flat 40% increase, and increased range, balanced by limited guns and self damage
|
|
||||||
//testing at 1.3: grenade(+0.3), missiles, flak, M80
|
|
||||||
b.modExplosionRadius = 1.8; //good for guns with explosions
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "ceramic plating",
|
|
||||||
description: "protection from to high <strong>temperatures</strong><br>5x less <strong class='color-d'>damage</strong> from <strong class='color-e'>explosions</strong> and lasers",
|
|
||||||
have: false, //5
|
|
||||||
effect: () => {
|
|
||||||
b.isModTempResist = true; //good for guns with explosions
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "ablative synthesis",
|
|
||||||
description: "rebuild your broken parts as <strong>drones</strong><br>chance to occur after taking <strong class='color-d'>damage</strong>",
|
|
||||||
have: false, //6
|
|
||||||
effect: () => { //makes dangerous situations more survivable
|
|
||||||
b.isModDroneOnDamage = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "zoospore vector",
|
|
||||||
description: "enemies can discharge <strong style='letter-spacing: 2px;'>spores</strong> on <strong>death</strong><br><strong style='letter-spacing: 2px;'>spores</strong> seek out enemies",
|
|
||||||
have: false, //7
|
|
||||||
effect: () => { //good late game maybe?
|
|
||||||
b.modSpores = 0.20;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "energy transfer",
|
|
||||||
description: "gain <strong class='color-f'>energy</strong> proportional to <strong class='color-d'>damage</strong> done",
|
|
||||||
have: false, //8
|
|
||||||
effect: () => { //good with laser, and all fields
|
|
||||||
b.modEnergySiphon = 0.2;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "entropy transfer",
|
|
||||||
description: "<strong class='color-h'>heal</strong> proportional to <strong class='color-d'>damage</strong> done",
|
|
||||||
have: false, //9
|
|
||||||
effect: () => { //good with guns that overkill: one shot, grenade
|
|
||||||
b.modHealthDrain = 0.015;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "quantum immortality",
|
|
||||||
description: "after <strong>dying</strong>, continue in an <em>alternate reality</em><br>guns, ammo, and field are randomized",
|
|
||||||
have: false, //10
|
|
||||||
effect: () => {
|
|
||||||
b.modIsImmortal = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "fluoroantimonic acid",
|
name: "fluoroantimonic acid",
|
||||||
description: "each bullet does extra chemical <strong class='color-d'>damage</strong><br>instant damage, unaffected by momentum",
|
description: "each bullet does extra chemical <strong class='color-d'>damage</strong><br>instant damage, unaffected by momentum",
|
||||||
@@ -156,42 +76,6 @@ const b = {
|
|||||||
b.modExtraDmg = 0.1
|
b.modExtraDmg = 0.1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "annihilation",
|
|
||||||
description: "after <strong>touching</strong> enemies, they are annihilated<br><em>doesn't trigger health or energy transfer</em>",
|
|
||||||
have: false, //12
|
|
||||||
effect: () => { //good with mods that heal: superconductive healing, entropy transfer
|
|
||||||
b.modAnnihilation = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "recursive healing",
|
|
||||||
description: "<strong class='color-h'>healing</strong> power ups bring you to <strong>full health</strong>",
|
|
||||||
have: false, //13
|
|
||||||
effect: () => { // good with ablative synthesis, melee builds
|
|
||||||
b.isModFullHeal = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Gauss rifle",
|
|
||||||
description: "<strong>launch blocks</strong> at much higher speeds<br>hold onto larger blocks even after getting hit",
|
|
||||||
have: false, //14
|
|
||||||
effect: () => { // good with guns that run out of ammo
|
|
||||||
mech.throwChargeRate = 4;
|
|
||||||
mech.throwChargeMax = 150;
|
|
||||||
mech.holdingMassScale = 0.05; //can hold heavier blocks with lower cost to jumping
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "squirrel-cage rotor",
|
|
||||||
description: "<strong>jump</strong> higher and <strong>move</strong> faster<br>reduced <strong>falling</strong> <strong class='color-d'>damage</strong>",
|
|
||||||
have: false, //15
|
|
||||||
effect: () => { // good with melee builds, content skipping builds
|
|
||||||
b.modSquirrelFx = 1.2;
|
|
||||||
mech.Fx = 0.015 * b.modSquirrelFx;
|
|
||||||
mech.jumpForce = 0.38 * 1.1;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "fracture analysis",
|
name: "fracture analysis",
|
||||||
description: "<strong>5x</strong> physical <strong class='color-d'>damage</strong> to unaware enemies<br><em>unaware enemies don't have a health bar</em>",
|
description: "<strong>5x</strong> physical <strong class='color-d'>damage</strong> to unaware enemies<br><em>unaware enemies don't have a health bar</em>",
|
||||||
@@ -216,6 +100,115 @@ const b = {
|
|||||||
b.isModLowHealthDmg = true; //used in mob.damage()
|
b.isModLowHealthDmg = true; //used in mob.damage()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "auto-loading heuristics",
|
||||||
|
description: "your <strong>delay</strong> after firing is 15% <strong>shorter</strong>",
|
||||||
|
have: false, //1
|
||||||
|
effect: () => { //good for guns with extra ammo: needles, M80, rapid fire, flak, super balls
|
||||||
|
b.modFireRate = 0.85
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "desublimated ammunition",
|
||||||
|
description: "use 50% less <strong>ammo</strong> when <strong>crouching</strong>",
|
||||||
|
have: false, //2
|
||||||
|
effect: () => { //good with guns that have less ammo: one shot, grenades, missiles, super balls, spray
|
||||||
|
b.modNoAmmo = 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Lorentzian topology",
|
||||||
|
description: "your <strong>bullets</strong> last 40% <strong>longer</strong>",
|
||||||
|
have: false, //3
|
||||||
|
effect: () => { //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
||||||
|
b.isModBulletsLastLonger = 1.40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "zoospore vector",
|
||||||
|
description: "enemies can discharge <strong style='letter-spacing: 2px;'>spores</strong> on <strong>death</strong><br><strong style='letter-spacing: 2px;'>spores</strong> seek out enemies",
|
||||||
|
have: false, //7
|
||||||
|
effect: () => { //good late game maybe?
|
||||||
|
b.modSpores = 0.20;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "ablative synthesis",
|
||||||
|
description: "rebuild your broken parts as <strong>drones</strong><br>chance to occur after taking <strong class='color-d'>damage</strong>",
|
||||||
|
have: false, //6
|
||||||
|
effect: () => { //makes dangerous situations more survivable
|
||||||
|
b.isModDroneOnDamage = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "annihilation",
|
||||||
|
description: "after <strong>touching</strong> enemies, they are annihilated<br><em>doesn't trigger health or energy transfer</em>",
|
||||||
|
have: false, //12
|
||||||
|
effect: () => { //good with mods that heal: superconductive healing, entropy transfer
|
||||||
|
b.modAnnihilation = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "anti-matter cores",
|
||||||
|
description: "the <strong>radius</strong> of your <strong class='color-e'>explosions</strong> is doubled<br><strong style='opacity:0.3;'>be careful</strong>",
|
||||||
|
have: false, //4
|
||||||
|
effect: () => { //at 1.4 gives a flat 40% increase, and increased range, balanced by limited guns and self damage
|
||||||
|
//testing at 1.3: grenade(+0.3), missiles, flak, M80
|
||||||
|
b.modExplosionRadius = 1.8; //good for guns with explosions
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "ceramic plating",
|
||||||
|
description: "protection from to high <strong>temperatures</strong><br>5x less <strong class='color-d'>damage</strong> from <strong class='color-e'>explosions</strong> and lasers",
|
||||||
|
have: false, //5
|
||||||
|
effect: () => {
|
||||||
|
b.isModTempResist = true; //good for guns with explosions
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Gauss rifle",
|
||||||
|
description: "<strong>launch blocks</strong> at much higher speeds<br>hold onto larger blocks even after getting hit",
|
||||||
|
have: false, //14
|
||||||
|
effect: () => { // good with guns that run out of ammo
|
||||||
|
mech.throwChargeRate = 4;
|
||||||
|
mech.throwChargeMax = 150;
|
||||||
|
mech.holdingMassScale = 0.05; //can hold heavier blocks with lower cost to jumping
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "squirrel-cage rotor",
|
||||||
|
description: "<strong>jump</strong> higher and <strong>move</strong> faster<br>reduced <strong>falling</strong> <strong class='color-d'>damage</strong>",
|
||||||
|
have: false, //15
|
||||||
|
effect: () => { // good with melee builds, content skipping builds
|
||||||
|
b.modSquirrelFx = 1.2;
|
||||||
|
mech.Fx = 0.015 * b.modSquirrelFx;
|
||||||
|
mech.jumpForce = 0.38 * 1.1;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "energy transfer",
|
||||||
|
description: "gain <strong class='color-f'>energy</strong> proportional to <strong class='color-d'>damage</strong> done",
|
||||||
|
have: false, //8
|
||||||
|
effect: () => { //good with laser, and all fields
|
||||||
|
b.modEnergySiphon = 0.2;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "entropy transfer",
|
||||||
|
description: "<strong class='color-h'>heal</strong> proportional to <strong class='color-d'>damage</strong> done",
|
||||||
|
have: false, //9
|
||||||
|
effect: () => { //good with guns that overkill: one shot, grenade
|
||||||
|
b.modHealthDrain = 0.015;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "entanglement",
|
||||||
|
description: "using your first gun reduces <strong class='color-d'>damage</strong> taken<br><em>scales by <strong>7%</strong> for each gun in your inventory</em>",
|
||||||
|
have: false, //20
|
||||||
|
effect: () => { // good with laser-bots
|
||||||
|
b.isModMonogamy = true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Bayesian inference",
|
name: "Bayesian inference",
|
||||||
description: "<strong>20%</strong> chance for double <strong>power ups</strong> to drop",
|
description: "<strong>20%</strong> chance for double <strong>power ups</strong> to drop",
|
||||||
@@ -224,22 +217,38 @@ const b = {
|
|||||||
b.modMoreDrops = 0.20;
|
b.modMoreDrops = 0.20;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "entanglement",
|
|
||||||
description: "using your first gun reduces <strong class='color-d'>damage</strong> taken<br><em>scales by <strong>7%</strong> for each gun in your inventory</em>",
|
|
||||||
have: false, //20
|
|
||||||
effect: () => { // good with long term planning
|
|
||||||
b.isModMonogamy = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "mass-energy equivalence",
|
name: "mass-energy equivalence",
|
||||||
description: "change the mass of <strong>power ups</strong> into <strong class='color-f'>energy</strong><br>power ups fill your <strong class='color-f'>energy</strong> and <strong class='color-h'>heal</strong> for +3%",
|
description: "change the mass of <strong>power ups</strong> into <strong class='color-f'>energy</strong><br>power ups fill your <strong class='color-f'>energy</strong> and <strong class='color-h'>heal</strong> for +3%",
|
||||||
have: false, //21
|
have: false, //21
|
||||||
effect: () => { // good with long term planning
|
effect: () => {
|
||||||
b.isModMassEnergy = true // used in mech.usePowerUp
|
b.isModMassEnergy = true // used in mech.usePowerUp
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "supersaturation",
|
||||||
|
description: "<strong class='color-h'>heal</strong> <strong>25%</strong> beyond your max health",
|
||||||
|
have: false, //22
|
||||||
|
effect: () => {
|
||||||
|
mech.maxHealth = 1.25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "recursive healing",
|
||||||
|
description: "<strong class='color-h'>healing</strong> power ups bring you to <strong>full health</strong>",
|
||||||
|
have: false, //13
|
||||||
|
effect: () => { // good with ablative synthesis, melee builds
|
||||||
|
b.isModFullHeal = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "quantum immortality",
|
||||||
|
description: "after <strong>dying</strong>, continue in an <em>alternate reality</em><br>guns, ammo, and field are randomized",
|
||||||
|
have: false, //10
|
||||||
|
effect: () => {
|
||||||
|
b.modIsImmortal = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
],
|
],
|
||||||
giveMod(i) {
|
giveMod(i) {
|
||||||
b.mods[i].effect(); //give specific mod
|
b.mods[i].effect(); //give specific mod
|
||||||
@@ -970,7 +979,8 @@ const b = {
|
|||||||
this.force.y += this.mass * 0.0005;
|
this.force.y += this.mass * 0.0005;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
name: "wave beam", //3
|
name: "wave beam", //3
|
||||||
description: "emit a <strong>sine wave</strong> of oscillating particles<br>particles propagate through <strong>walls</strong>",
|
description: "emit a <strong>sine wave</strong> of oscillating particles<br>particles propagate through <strong>walls</strong>",
|
||||||
ammo: 0,
|
ammo: 0,
|
||||||
@@ -979,11 +989,11 @@ const b = {
|
|||||||
isStarterGun: true,
|
isStarterGun: true,
|
||||||
fire() {
|
fire() {
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
const DIR = mech.angle
|
const dir = mech.angle
|
||||||
const SCALE = (mech.crouch ? 0.963 : 0.95)
|
const SCALE = (mech.crouch ? 0.963 : 0.95)
|
||||||
const wiggleMag = ((mech.flipLegs === 1) ? 1 : -1) * ((mech.crouch) ? 0.004 : 0.005)
|
const wiggleMag = ((mech.flipLegs === 1) ? 1 : -1) * ((mech.crouch) ? 0.004 : 0.005)
|
||||||
bullet[me] = Bodies.circle(mech.pos.x + 25 * Math.cos(DIR), mech.pos.y + 25 * Math.sin(DIR), 10 * b.modBulletSize, {
|
bullet[me] = Bodies.circle(mech.pos.x + 25 * Math.cos(dir), mech.pos.y + 25 * Math.sin(dir), 10 * b.modBulletSize, {
|
||||||
angle: DIR,
|
angle: dir,
|
||||||
cycle: -0.43, //adjust this number until the bullets line up with the cross hairs
|
cycle: -0.43, //adjust this number until the bullets line up with the cross hairs
|
||||||
endCycle: game.cycle + Math.floor((mech.crouch ? 155 : 120) * b.isModBulletsLastLonger),
|
endCycle: game.cycle + Math.floor((mech.crouch ? 155 : 120) * b.isModBulletsLastLonger),
|
||||||
inertia: Infinity,
|
inertia: Infinity,
|
||||||
@@ -1011,8 +1021,8 @@ const b = {
|
|||||||
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 8 : 4) * b.modFireRate); // cool down
|
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 8 : 4) * b.modFireRate); // cool down
|
||||||
const SPEED = mech.crouch ? 5.2 : 4.5;
|
const SPEED = mech.crouch ? 5.2 : 4.5;
|
||||||
Matter.Body.setVelocity(bullet[me], {
|
Matter.Body.setVelocity(bullet[me], {
|
||||||
x: SPEED * Math.cos(DIR),
|
x: SPEED * Math.cos(dir),
|
||||||
y: SPEED * Math.sin(DIR)
|
y: SPEED * Math.sin(dir)
|
||||||
});
|
});
|
||||||
bullet[me].direction = Matter.Vector.perp(bullet[me].velocity)
|
bullet[me].direction = Matter.Vector.perp(bullet[me].velocity)
|
||||||
// if (mech.angle + Math.PI / 2 > 0) {
|
// if (mech.angle + Math.PI / 2 > 0) {
|
||||||
@@ -1083,7 +1093,7 @@ const b = {
|
|||||||
name: "fléchettes", //6
|
name: "fléchettes", //6
|
||||||
description: "fire a flight of long range needles",
|
description: "fire a flight of long range needles",
|
||||||
ammo: 0,
|
ammo: 0,
|
||||||
ammoPack: 25,
|
ammoPack: 16,
|
||||||
have: false,
|
have: false,
|
||||||
isStarterGun: true,
|
isStarterGun: true,
|
||||||
fire() {
|
fire() {
|
||||||
@@ -1781,6 +1791,84 @@ const b = {
|
|||||||
b.drawOneBullet(bullet[me].vertices);
|
b.drawOneBullet(bullet[me].vertices);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "chronon", //15
|
||||||
|
description: "fire a bubble of null time<br>enemies are frozen for 5 seconds",
|
||||||
|
ammo: 0,
|
||||||
|
ammoPack: 80,
|
||||||
|
have: false,
|
||||||
|
isStarterGun: true,
|
||||||
|
fire() {
|
||||||
|
const me = bullet.length;
|
||||||
|
const dir = mech.angle
|
||||||
|
const RADIUS = 23 + 45 * Math.random()
|
||||||
|
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 0, RADIUS, {
|
||||||
|
density: 0.0001, // 0.1 normal density to keep damage consistent
|
||||||
|
frictionAir: 0,
|
||||||
|
restitution: 0.3,
|
||||||
|
angle: dir,
|
||||||
|
friction: 0,
|
||||||
|
frictionAir: 0,
|
||||||
|
dmg: 0.5 + b.modExtraDmg, //damage done in addition to the damage from momentum
|
||||||
|
classType: "bullet",
|
||||||
|
collisionFilter: {
|
||||||
|
category: 0x000100,
|
||||||
|
mask: 0x010011 //mask: 0x000101, //for self collision
|
||||||
|
},
|
||||||
|
minDmgSpeed: 0,
|
||||||
|
endCycle: Infinity, //game.cycle + Math.floor(265 * b.isModBulletsLastLonger),
|
||||||
|
radius: RADIUS,
|
||||||
|
onDmg(who) {
|
||||||
|
this.endCycle = 0; //bullet ends cycle after doing damage // also triggers explosion
|
||||||
|
if (!who.isSleeping) {
|
||||||
|
const sleep = function (who) {
|
||||||
|
if (who) {
|
||||||
|
who.storeVelocity = who.velocity
|
||||||
|
who.storeAngularVelocity = who.angularVelocity
|
||||||
|
Matter.Sleeping.set(who, true)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
setTimeout(sleep, 1, who);
|
||||||
|
|
||||||
|
const awake = function (who) {
|
||||||
|
if (who) {
|
||||||
|
Matter.Sleeping.set(who, false)
|
||||||
|
if (who.storeVelocity) {
|
||||||
|
Matter.Body.setVelocity(who, {
|
||||||
|
x: who.storeVelocity.x,
|
||||||
|
y: who.storeVelocity.y
|
||||||
|
})
|
||||||
|
Matter.Body.setAngularVelocity(who, who.storeAngularVelocity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
setTimeout(awake, 5000, who);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onEnd() {},
|
||||||
|
do() {
|
||||||
|
//shrink
|
||||||
|
const SCALE = 0.994
|
||||||
|
Matter.Body.scale(this, SCALE, SCALE);
|
||||||
|
this.radius *= SCALE;
|
||||||
|
if (this.radius < 5) this.endCycle = 0;
|
||||||
|
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.arc(this.position.x, this.position.y, this.radius - 2, 0, 2 * Math.PI);
|
||||||
|
ctx.fillStyle = "#fff"
|
||||||
|
ctx.fill()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
World.add(engine.world, bullet[me]); //add bullet to world
|
||||||
|
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 13 : 7) * b.modFireRate); // cool down
|
||||||
|
const SPEED = mech.crouch ? 9 : 5;
|
||||||
|
Matter.Body.setVelocity(bullet[me], {
|
||||||
|
x: mech.Vx / 2 + SPEED * Math.cos(dir),
|
||||||
|
y: mech.Vy / 2 + SPEED * Math.sin(dir)
|
||||||
|
});
|
||||||
|
bullet[me].direction = Matter.Vector.perp(bullet[me].velocity)
|
||||||
|
}
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// name: "dwarf star", //14
|
// name: "dwarf star", //14
|
||||||
// description: "drop a mine that gravitational pulls in matter",
|
// description: "drop a mine that gravitational pulls in matter",
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ function mobCollisionChecks(event) {
|
|||||||
if (b.modIsCrit && !mob[k].seePlayer.recall) dmg *= 5
|
if (b.modIsCrit && !mob[k].seePlayer.recall) dmg *= 5
|
||||||
mob[k].foundPlayer();
|
mob[k].foundPlayer();
|
||||||
mob[k].damage(dmg);
|
mob[k].damage(dmg);
|
||||||
obj.onDmg(); //some bullets do actions when they hits things, like despawn
|
obj.onDmg(mob[k]); //some bullets do actions when they hits things, like despawn
|
||||||
game.drawList.push({
|
game.drawList.push({
|
||||||
//add dmg to draw queue
|
//add dmg to draw queue
|
||||||
x: pairs[i].activeContacts[0].vertex.x,
|
x: pairs[i].activeContacts[0].vertex.x,
|
||||||
|
|||||||
10
js/level.js
10
js/level.js
@@ -14,12 +14,12 @@ const level = {
|
|||||||
start() {
|
start() {
|
||||||
if (level.levelsCleared === 0) {
|
if (level.levelsCleared === 0) {
|
||||||
// game.difficulty = 6; //for testing to simulate possible mobs spawns
|
// game.difficulty = 6; //for testing to simulate possible mobs spawns
|
||||||
// b.giveGuns(14)
|
b.giveGuns(15)
|
||||||
// mech.fieldUpgrades[7].effect();
|
mech.fieldUpgrades[1].effect();
|
||||||
// b.giveMod(2)
|
// b.giveMod(2)
|
||||||
|
|
||||||
this.intro(); //starting level
|
// this.intro(); //starting level
|
||||||
// this.testingMap();
|
this.testingMap();
|
||||||
// this.bosses();
|
// this.bosses();
|
||||||
// this.aerie();
|
// this.aerie();
|
||||||
// this.rooftops();
|
// this.rooftops();
|
||||||
@@ -110,7 +110,7 @@ const level = {
|
|||||||
// powerUps.spawn(450, -400, "mod", false, 6);
|
// powerUps.spawn(450, -400, "mod", false, 6);
|
||||||
// powerUps.spawn(450, -400, "mod", false);
|
// powerUps.spawn(450, -400, "mod", false);
|
||||||
// spawn.bodyRect(-45, -100, 40, 50);
|
// spawn.bodyRect(-45, -100, 40, 50);
|
||||||
spawn.spinner(800, -1150);
|
spawn.shooter(800, -1150);
|
||||||
// spawn.groupBoss(-600, -550);
|
// spawn.groupBoss(-600, -550);
|
||||||
// spawn.hopper(800, -150);
|
// spawn.hopper(800, -150);
|
||||||
// spawn.beamer(800, -150);
|
// spawn.beamer(800, -150);
|
||||||
|
|||||||
@@ -696,7 +696,7 @@ const mobs = {
|
|||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
grow() {
|
grow() {
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!this.isSleeping) {
|
||||||
if (this.seePlayer.recall) {
|
if (this.seePlayer.recall) {
|
||||||
if (this.radius < 80) {
|
if (this.radius < 80) {
|
||||||
const scale = 1.01;
|
const scale = 1.01;
|
||||||
@@ -830,7 +830,7 @@ const mobs = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fire() {
|
fire() {
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!this.isSleeping) {
|
||||||
const setNoseShape = () => {
|
const setNoseShape = () => {
|
||||||
const mag = this.radius + this.radius * this.noseLength;
|
const mag = this.radius + this.radius * this.noseLength;
|
||||||
this.vertices[1].x = this.position.x + Math.cos(this.angle) * mag;
|
this.vertices[1].x = this.position.x + Math.cos(this.angle) * mag;
|
||||||
@@ -906,7 +906,7 @@ const mobs = {
|
|||||||
this.death(); //death with no power up or body
|
this.death(); //death with no power up or body
|
||||||
},
|
},
|
||||||
timeLimit() {
|
timeLimit() {
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!this.isSleeping) {
|
||||||
this.timeLeft--;
|
this.timeLeft--;
|
||||||
if (this.timeLeft < 0) {
|
if (this.timeLeft < 0) {
|
||||||
this.dropPowerUp = false;
|
this.dropPowerUp = false;
|
||||||
|
|||||||
@@ -406,6 +406,7 @@ const mech = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
health: 0,
|
health: 0,
|
||||||
|
maxHealth: 1,
|
||||||
drawHealth() {
|
drawHealth() {
|
||||||
if (this.health < 1) {
|
if (this.health < 1) {
|
||||||
ctx.fillStyle = "rgba(100, 100, 100, 0.5)";
|
ctx.fillStyle = "rgba(100, 100, 100, 0.5)";
|
||||||
@@ -431,7 +432,7 @@ const mech = {
|
|||||||
},
|
},
|
||||||
addHealth(heal) {
|
addHealth(heal) {
|
||||||
this.health += heal;
|
this.health += heal;
|
||||||
if (this.health > 1 || b.isModFullHeal) this.health = 1;
|
if (this.health > mech.maxHealth) this.health = mech.maxHealth;
|
||||||
this.displayHealth();
|
this.displayHealth();
|
||||||
},
|
},
|
||||||
defaultFPSCycle: 0, //tracks when to return to normal fps
|
defaultFPSCycle: 0, //tracks when to return to normal fps
|
||||||
@@ -882,7 +883,6 @@ const mech = {
|
|||||||
//knock backs
|
//knock backs
|
||||||
const unit = Matter.Vector.normalise(Matter.Vector.sub(player.position, who.position))
|
const unit = Matter.Vector.normalise(Matter.Vector.sub(player.position, who.position))
|
||||||
const mass = Math.min(Math.sqrt(who.mass), 3.5); //large masses above 4*4 can start to overcome the push back
|
const mass = Math.min(Math.sqrt(who.mass), 3.5); //large masses above 4*4 can start to overcome the push back
|
||||||
console.log(Math.sqrt(who.mass), mass)
|
|
||||||
Matter.Body.setVelocity(who, {
|
Matter.Body.setVelocity(who, {
|
||||||
x: player.velocity.x - (15 * unit.x) / mass,
|
x: player.velocity.x - (15 * unit.x) / mass,
|
||||||
y: player.velocity.y - (15 * unit.y) / mass
|
y: player.velocity.y - (15 * unit.y) / mass
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ const powerUps = {
|
|||||||
},
|
},
|
||||||
effect() {
|
effect() {
|
||||||
let heal = (this.size / 40) ** 2
|
let heal = (this.size / 40) ** 2
|
||||||
if (b.fullHeal) heal = Infinity
|
heal = Math.min(mech.maxHealth - mech.health, heal)
|
||||||
heal = Math.min(1 - mech.health, heal)
|
if (b.isModFullHeal) heal = mech.maxHealth
|
||||||
mech.addHealth(heal);
|
mech.addHealth(heal);
|
||||||
if (heal > 0) game.makeTextLog("<div class='circle heal'></div> <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (heal * 100).toFixed(0) + "%</span>", 300)
|
if (heal > 0) game.makeTextLog("<div class='circle heal'></div> <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (heal * 100).toFixed(0) + "%</span>", 300)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -600,7 +600,7 @@ const spawn = {
|
|||||||
// if (Math.random() < Math.min(0.2 + game.difficulty * 0.1, 0.7)) spawn.shield(me, x, y);
|
// if (Math.random() < Math.min(0.2 + game.difficulty * 0.1, 0.7)) spawn.shield(me, x, y);
|
||||||
me.do = function () {
|
me.do = function () {
|
||||||
this.healthBar();
|
this.healthBar();
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!this.isSleeping) {
|
||||||
this.seePlayerByLookingAt();
|
this.seePlayerByLookingAt();
|
||||||
const dist2 = this.distanceToPlayer2();
|
const dist2 = this.distanceToPlayer2();
|
||||||
//laser Tracking
|
//laser Tracking
|
||||||
@@ -703,7 +703,7 @@ const spawn = {
|
|||||||
this.attraction();
|
this.attraction();
|
||||||
this.gravity();
|
this.gravity();
|
||||||
//draw
|
//draw
|
||||||
if (!mech.isBodiesAsleep) {
|
if (!this.isSleeping) {
|
||||||
if (this.seePlayer.yes) {
|
if (this.seePlayer.yes) {
|
||||||
if (this.alpha < 1) this.alpha += 0.01;
|
if (this.alpha < 1) this.alpha += 0.01;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user