bubble fusion
This commit is contained in:
40
js/bullet.js
40
js/bullet.js
@@ -378,7 +378,7 @@ const b = {
|
||||
if (collide.length > 0) {
|
||||
for (let i = 0; i < collide.length; i++) {
|
||||
if (collide[i].bodyA.collisionFilter.category === cat.map) { // || collide[i].bodyB.collisionFilter.category === cat.map) {
|
||||
const angle = Matter.Vector.angle(collide[i].normal, {
|
||||
const angle = Vector.angle(collide[i].normal, {
|
||||
x: 1,
|
||||
y: 0
|
||||
})
|
||||
@@ -726,14 +726,14 @@ const b = {
|
||||
let closeDist = Infinity;
|
||||
for (let i = 0, len = powerUp.length; i < len; ++i) {
|
||||
if (
|
||||
((powerUp[i].name !== "field" && powerUp[i].name !== "heal") || (powerUp[i].name === "heal" && mech.health < 0.8)) &&
|
||||
((powerUp[i].name !== "field" && powerUp[i].name !== "heal") || (powerUp[i].name === "heal" && mech.health < 0.9)) &&
|
||||
Matter.Query.ray(map, this.position, powerUp[i].position).length === 0 &&
|
||||
Matter.Query.ray(body, this.position, powerUp[i].position).length === 0
|
||||
) {
|
||||
const TARGET_VECTOR = Vector.sub(this.position, powerUp[i].position)
|
||||
const DIST = Vector.magnitude(TARGET_VECTOR);
|
||||
if (DIST < closeDist) {
|
||||
if (DIST < 50) { //eat the power up if close enough
|
||||
if (DIST < 60) { //eat the power up if close enough
|
||||
powerUp[i].effect();
|
||||
Matter.World.remove(engine.world, powerUp[i]);
|
||||
powerUp.splice(i, 1);
|
||||
@@ -875,7 +875,7 @@ const b = {
|
||||
if (this.target.isShielded) {
|
||||
this.target.damage(b.dmgScale * 0.005, true); //shield damage bypass
|
||||
//shrink if mob is shielded
|
||||
const SCALE = 1 - 0.025 / mod.isBulletsLastLonger
|
||||
const SCALE = 1 - 0.016 / mod.isBulletsLastLonger
|
||||
Matter.Body.scale(this, SCALE, SCALE);
|
||||
this.radius *= SCALE;
|
||||
} else {
|
||||
@@ -886,14 +886,28 @@ const b = {
|
||||
this.collisionFilter.category = cat.bullet;
|
||||
this.collisionFilter.mask = cat.mob //| cat.mobShield //cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield
|
||||
if (mod.isFoamGrowOnDeath) {
|
||||
// const SCALE = (this.radius < 30) ? 2 : 1 //Math.min(5, Math.max(1, 20 / (this.radius * this.radius)))
|
||||
// Matter.Body.scale(this, SCALE, SCALE);
|
||||
// this.radius *= SCALE;
|
||||
const radius = Math.min(this.radius / 2, 10)
|
||||
b.foam(this.position, Matter.Vector.rotate(this.velocity, Math.PI * 2 / 3), radius)
|
||||
b.foam(this.position, Matter.Vector.rotate(this.velocity, Math.PI * 1 / 3), radius)
|
||||
let targets = []
|
||||
for (let i = 0, len = mob.length; i < len; i++) {
|
||||
const dist = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position));
|
||||
if (dist < 1000000) {
|
||||
targets.push(mob[i])
|
||||
}
|
||||
}
|
||||
const radius = Math.min(this.radius * 0.5, 10)
|
||||
for (let i = 0; i < 2; i++) {
|
||||
if (targets.length - i > 0) {
|
||||
const index = Math.floor(Math.random() * targets.length)
|
||||
const speed = 10 + 10 * Math.random()
|
||||
const velocity = Vector.mult(Vector.normalise(Vector.sub(targets[index].position, this.position)), speed)
|
||||
b.foam(this.position, Vector.rotate(velocity, 0.5 * (Math.random() - 0.5)), radius)
|
||||
} else {
|
||||
b.foam(this.position, Vector.rotate({
|
||||
x: 15 + 10 * Math.random(),
|
||||
y: 0
|
||||
}, 2 * Math.PI * Math.random()), radius)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1392,7 +1406,7 @@ const b = {
|
||||
function makeFlechette(angle = mech.angle + 0.02 * (Math.random() - 0.5)) {
|
||||
const me = bullet.length;
|
||||
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle), 45, 1.4, b.fireAttributes(angle));
|
||||
bullet[me].collisionFilter.mask = cat.body; //cat.mobShield | //cat.map | cat.body |
|
||||
bullet[me].collisionFilter.mask = mod.pierce ? 0 : cat.body; //cat.mobShield | //cat.map | cat.body |
|
||||
Matter.Body.setDensity(bullet[me], 0.00001); //0.001 is normal
|
||||
bullet[me].endCycle = game.cycle + 180;
|
||||
bullet[me].dmg = 0;
|
||||
@@ -2269,7 +2283,7 @@ const b = {
|
||||
if (who.shield) {
|
||||
for (let i = 0, len = mob.length; i < len; i++) {
|
||||
if (mob[i].id === who.shieldTargetID) { //apply some knock back to shield mob before shield breaks
|
||||
Matter.Body.setVelocity(mob[i], Matter.Vector.mult(Matter.Vector.normalise(this.velocity), 10));
|
||||
Matter.Body.setVelocity(mob[i], Vector.mult(Vector.normalise(this.velocity), 10));
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ const level = {
|
||||
if (level.levelsCleared === 0) { //this code only runs on the first level
|
||||
// game.enableConstructMode() //used to build maps in testing mode
|
||||
// level.difficultyIncrease(9)
|
||||
|
||||
mod.giveMod("automatic shotgun");
|
||||
// b.giveGuns("spores")
|
||||
// mech.setField("plasma torch")
|
||||
// mech.isStealth = true;
|
||||
// mod.giveMod("necrophoresis");
|
||||
// b.giveGuns("foam")
|
||||
// mech.setField("time dilation field")
|
||||
|
||||
level.intro(); //starting level
|
||||
// level.testing();
|
||||
|
||||
13
js/mob.js
13
js/mob.js
@@ -991,7 +991,7 @@ const mobs = {
|
||||
this.alive = false; //triggers mob removal in mob[i].replace(i)
|
||||
if (this.dropPowerUp) {
|
||||
if (mod.isEnergyLoss) mech.energy *= 0.66;
|
||||
powerUps.spawnRandomPowerUp(this.position.x, this.position.y, this.mass, radius);
|
||||
powerUps.spawnRandomPowerUp(this.position.x, this.position.y);
|
||||
mech.lastKillCycle = mech.cycle; //tracks the last time a kill was made, mostly used in game.checks()
|
||||
if (Math.random() < mod.sporesOnDeath) {
|
||||
const len = Math.min(30, Math.floor(4 + this.mass * Math.random()))
|
||||
@@ -1011,6 +1011,17 @@ const mobs = {
|
||||
}
|
||||
if (mod.isExplodeMob) b.explosion(this.position, Math.min(450, Math.sqrt(this.mass + 3) * 80))
|
||||
if (mod.nailsDeathMob) b.targetedNail(this.position, mod.nailsDeathMob)
|
||||
} else if (mod.isShieldAmmo && this.shield) {
|
||||
let type = "ammo"
|
||||
if (Math.random() < 0.33 || mod.bayesian) {
|
||||
type = "heal"
|
||||
} else if (Math.random() < 0.5 && !mod.isSuperDeterminism) {
|
||||
type = "reroll"
|
||||
}
|
||||
for (let i = 0; i < 3; i++) {
|
||||
powerUps.spawn(this.position.x, this.position.y, type);
|
||||
if (Math.random() < mod.bayesian) powerUps.spawn(this.position.x, this.position.y, type);
|
||||
}
|
||||
}
|
||||
},
|
||||
removeConsBB() {
|
||||
|
||||
20
js/mods.js
20
js/mods.js
@@ -785,6 +785,22 @@ const mod = {
|
||||
mod.isMassEnergy = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "bubble fusion",
|
||||
description: "after destroying a mob's <strong>shield</strong><br>spawn <strong>3</strong> <strong class='color-h'>heals</strong>, <strong>ammo</strong>, or <strong class='color-r'>rerolls</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
return true
|
||||
},
|
||||
requires: "",
|
||||
effect() {
|
||||
mod.isShieldAmmo = true;
|
||||
},
|
||||
remove() {
|
||||
mod.isShieldAmmo = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Bayesian inference",
|
||||
description: "<strong>40%</strong> chance for double <strong>power ups</strong> to drop<br><strong>ammo</strong> will no longer <strong>spawn</strong> from mobs",
|
||||
@@ -1275,7 +1291,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "piercing needles",
|
||||
description: "<strong>needles</strong> penetrate <strong>mobs</strong><br>potentially hitting <strong>multiple</strong> targets",
|
||||
description: "<strong>needles</strong> penetrate <strong>mobs</strong> and <strong>blocks</strong><br>potentially hitting <strong>multiple</strong> targets",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
@@ -1634,7 +1650,7 @@ const mod = {
|
||||
},
|
||||
{
|
||||
name: "necrophoresis",
|
||||
description: "<strong>foam</strong> splits into 3 <strong>copies</strong><br>when the mob it's stuck to <strong>dies</strong>",
|
||||
description: "if the mob <strong>foam</strong> is stuck to <strong>dies</strong><br><strong>foam</strong> grows and splits into 3 <strong>copies</strong>",
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
allowed() {
|
||||
|
||||
@@ -1992,7 +1992,7 @@ const mech = {
|
||||
|
||||
for (let i = 0, len = body.length; i < len; ++i) {
|
||||
if (Vector.magnitude(Vector.sub(body[i].position, mech.fieldPosition)) < mech.fieldRadius) {
|
||||
const DRAIN = speed * body[i].mass * 0.000018
|
||||
const DRAIN = speed * body[i].mass * 0.000015
|
||||
if (mech.energy > DRAIN) {
|
||||
mech.energy -= DRAIN;
|
||||
Matter.Body.setVelocity(body[i], velocity); //give block mouse velocity
|
||||
|
||||
12
todo.txt
12
todo.txt
@@ -4,21 +4,21 @@ freezing status effects only last 1/4 as long on boss mobs
|
||||
mod - shotgun 66% increased fire rate and recoil
|
||||
mod - slowly heal when below 25% health
|
||||
mod - superdeterminism spawn 4 mods, but rerolls, fields, and guns no longer spawn
|
||||
foam mod, necrophoresis now aims the foam bullets, which makes it more effective at groups
|
||||
flechettes mod, piercing needles now goes through blocks as well as mobs
|
||||
mod - spawn 3 ammo, rerolls, or heals after destroying a shield
|
||||
|
||||
************** TODO - n-gon **************
|
||||
physics question: why don't the bound states of fields spread out. What is making them bound.
|
||||
|
||||
rework reaction inhibitor to spawn mobs with 12% less life, rather then killing them at 12%
|
||||
mobs killed by _____ always drops ammo
|
||||
issues getting the code to work
|
||||
|
||||
mod: all mobs have a shield (or just a higher rate)
|
||||
all mobs drop an extra ammo power up?
|
||||
rework reaction inhibitor to spawn mobs with 12% less life, rather then killing them at 12%
|
||||
|
||||
levels: make a function in the main game loop that runs level specific code
|
||||
reset the level function as each new level loads
|
||||
|
||||
mod: foam grenades
|
||||
or maybe all explosions make foam?
|
||||
|
||||
mod: use the stealth flag from the phase decoherence field
|
||||
maybe trigger it along with the damage immunity CD
|
||||
|
||||
|
||||
Reference in New Issue
Block a user