setting up status effecs on mobs

This commit is contained in:
lilgreenland
2020-03-06 14:28:21 -08:00
parent 1fa80ecc79
commit d13c4e1ca8
5 changed files with 33 additions and 14 deletions

View File

@@ -2062,6 +2062,19 @@ const b = {
bullet[me].endCycle = game.cycle + 70;
bullet[me].dmg = 0.07;
bullet[me].frictionAir = mech.crouch ? 0.007 : 0.01;
bullet[me].onDmg = function (who) {
who.status.push({ //slow
endCycle: game.cycle + 60,
effect() {
Matter.Body.setVelocity(who, {
x: who.velocity.x * 0.8,
y: who.velocity.y * 0.8
});
},
})
};
bullet[me].do = function () {
this.force.y += this.mass * 0.0005;
};

View File

@@ -14,13 +14,13 @@ const level = {
start() {
if (level.levelsCleared === 0) {
// level.difficultyIncrease(9)
// b.giveGuns("wave beam")
b.giveGuns("minigun")
// mech.setField("phase decoherence field")
// b.giveMod("quantum dissipation");
// b.giveMod("reflective cavity");
level.intro(); //starting level
// level.testingMap();
// level.intro(); //starting level
level.testingMap();
// level.bosses();
// level.satellite();
// level.skyscrapers();
@@ -140,8 +140,8 @@ const level = {
// powerUps.spawn(450, -400, "mod", false, 6);
// powerUps.spawn(450, -400, "mod", false);
// spawn.bodyRect(-45, -100, 40, 50);
spawn.springer(800, -450);
spawn.cellBoss(400, -750);
spawn.starter(800, -450);
// spawn.cellBoss(400, -750);
// spawn.randomLevelBoss(400, -750)

View File

@@ -7,6 +7,11 @@ const mobs = {
while (i--) {
if (mob[i].alive) {
mob[i].do();
// let j = mob[i].status.length;
// while (j--) {
// mob[i].status[j].effect();
// if (mob[i].status[j].endCycle > game.cycle) mob[i].status.splice(j, 0);
// }
} else {
mob[i].replace(i); //removing mob and replace with body, this is done here to avoid an array index bug with drawing I think
}
@@ -97,6 +102,14 @@ const mobs = {
x: xPos,
y: yPos
},
status: [], // [ { effect(), endCycle } ]
checkStatus() {
let j = this.status.length;
while (j--) {
this.status[j].effect();
if (this.status[j].endCycle < game.cycle) this.status.splice(j, 1);
}
},
seeAtDistance2: 4000000, //sqrt(4000000) = 2000 = max seeing range
distanceToPlayer() {
const dx = this.position.x - player.position.x;

View File

@@ -142,6 +142,7 @@ const spawn = {
Matter.Body.setDensity(me, 0.0005) // normal density is 0.001 // this reduces life by half and decreases knockback
me.do = function () {
this.checkStatus()
this.seePlayerByLookingAt();
this.attraction();
};

View File

@@ -3,11 +3,6 @@
mod - lose your field, gain a gun and some ammo
gain two guns?
mod - vacuum bomb pulls shields off the mob
or just greatly damages shields during the suck phase if the pulling doesn't work
mod - vacuum bomb stuns after the explosion
maybe it also does DoT damage
mod - time dilation - Quantum Recovery
Expending all your energy while using the field will
cause the player to go back in time to 3 seconds before the field was activated
@@ -30,6 +25,7 @@ mobs - add in a function to the main loops that does injected code for each mob
mod - flechettes mod for DoT poison damage
mod - grenade explosions stun enemies
mod - give crystal minigun a slowing effect and rename it ice crystals
mod - vacuum bomb does DoT damage after exploding
mod - get your next recursive mod 3 times
are players aware of what a recursive mod is?
@@ -38,10 +34,6 @@ mod - get your next recursive mod 3 times
settings - auto aim at nearest mob
settings - custom keys binding
mod - rocket propelled grenades
grenades do +20% damage and move in an accelerating path
maybe explode on collision with map?
gun - buff vacuum bomb
its weak late game
can't spam it faster