ice IX energy

laser bots now use the same laser code as the player
mod: thermoelectric effect - ice IX bullets give you 7% energy after they collides with mobs
This commit is contained in:
landgreen
2020-10-04 18:16:01 -07:00
parent b1f4109827
commit 7947e69d4d
6 changed files with 144 additions and 86 deletions

View File

@@ -1303,6 +1303,20 @@ const mech = {
// mech.fieldArc = 0.3; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
// mech.calculateFieldThreshold();
mech.hold = function () {
//cap mob speed based on distance
for (let i = 0; i < mob.length; i++) {
const distance = Vector.magnitude(Vector.sub(mech.pos, mob[i].position))
const range = 1000
if (distance < range) {
const cap = Math.max(0.01 * distance, 4)
if (mob[i].speed > cap) {
Matter.Body.setVelocity(mob[i], Vector.mult(Vector.normalise(mob[i].velocity), cap)); //set velocity to cap, but keep the direction
}
}
}
const wave = Math.sin(mech.cycle * 0.022);
mech.fieldRange = 170 + 12 * wave
mech.fieldArc = 0.33 + 0.045 * wave //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)