more drone and swarm balance

This commit is contained in:
landgreen
2019-09-04 04:51:50 -07:00
parent 6dc30ddc2d
commit 58650b1166
2 changed files with 20 additions and 19 deletions

View File

@@ -721,20 +721,19 @@ const b = {
{ {
name: "swarm", name: "swarm",
ammo: 0, ammo: 0,
ammoPack: 6, ammoPack: 7,
have: false, have: false,
fire() { fire() {
const me = bullet.length; const me = bullet.length;
const dir = mech.angle; const dir = mech.angle;
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, b.fireAttributes(dir)); bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, 4.5, b.fireAttributes(dir));
bullet[me].radius = 22; //used from drawing timer b.fireProps(40, 15, dir, me); //cd , speed
b.fireProps(50, 8, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices); b.drawOneBullet(bullet[me].vertices);
Matter.Body.setDensity(bullet[me], 0.000001); Matter.Body.setDensity(bullet[me], 0.000001);
bullet[me].endCycle = game.cycle + 140; bullet[me].endCycle = game.cycle + 250;
bullet[me].frictionAir = 0.006; bullet[me].frictionAir = 0.001;
bullet[me].friction = 0; bullet[me].friction = 0.5;
bullet[me].restitution = 0.5; bullet[me].restitution = 0.3;
// Matter.Body.setDensity(bullet[me], 0.000001); // Matter.Body.setDensity(bullet[me], 0.000001);
// bullet[me].friction = 0.15; // bullet[me].friction = 0.15;
// bullet[me].restitution = 0; // bullet[me].restitution = 0;
@@ -742,16 +741,18 @@ const b = {
// bullet[me].explodeRad = 350 + Math.floor(Math.random() * 60); // bullet[me].explodeRad = 350 + Math.floor(Math.random() * 60);
bullet[me].minDmgSpeed = 0; bullet[me].minDmgSpeed = 0;
bullet[me].onDmg = function () { bullet[me].onDmg = function () {
this.endCycle = 0; //bullet ends cycle after doing damage //this triggers explosion // this.endCycle = 0; //bullet ends cycle after doing damage //this triggers explosion
}; };
bullet[me].do = function () { bullet[me].do = function () {
//extra gravity for harder arcs const SCALE = 1.007
this.force.y += this.mass * 0.002; Matter.Body.scale(this, SCALE, SCALE);
this.force.y += this.mass * 0.0005;
}; };
//spawn bullets on end //spawn bullets on end
bullet[me].onEnd = function () { bullet[me].onEnd = function () {
const NUM = 12 const NUM = 11;
for (let i = 0; i < NUM; i++) { for (let i = 0; i < NUM; i++) {
const bIndex = bullet.length; const bIndex = bullet.length;
const RADIUS = 5 + 2 * (Math.random() - 0.5) const RADIUS = 5 + 2 * (Math.random() - 0.5)
@@ -761,12 +762,13 @@ const b = {
angle: dir, angle: dir,
friction: 0, friction: 0,
frictionAir: 0.01, frictionAir: 0.01,
dmg: 0, //damage done in addition to the damage from momentum dmg: 1.25, //damage done in addition to the damage from momentum
classType: "bullet", classType: "bullet",
collisionFilter: { collisionFilter: {
category: 0x000100, category: 0x000100,
mask: 0x000011 //mask: 0x000101, //for self collision mask: 0x000011 //mask: 0x000101, //for self collision
}, },
endCycle: game.cycle + 300 + Math.floor(Math.random() * 120),
minDmgSpeed: 0, minDmgSpeed: 0,
onDmg() { onDmg() {
this.endCycle = 0; //bullet ends cycle after doing damage this.endCycle = 0; //bullet ends cycle after doing damage
@@ -794,6 +796,7 @@ const b = {
this.close = mob[i].position; this.close = mob[i].position;
closeDist = dist; closeDist = dist;
this.lockedOn = Matter.Vector.normalise(targetVector); this.lockedOn = Matter.Vector.normalise(targetVector);
if (0.3 > Math.random()) break //doesn't always target the closest mob
} }
} }
} }
@@ -806,8 +809,6 @@ const b = {
} }
}, },
}); });
bullet[bIndex].endCycle = game.cycle + 300 + Math.floor(Math.random() * 120);
bullet[bIndex].dmg = 1.6;
// bullet[bIndex].explodeRad = 100 + Math.floor(Math.random() * 30); // bullet[bIndex].explodeRad = 100 + Math.floor(Math.random() * 30);
// bullet[bIndex].onEnd = b.explode; //makes bullet do explosive damage before despawn // bullet[bIndex].onEnd = b.explode; //makes bullet do explosive damage before despawn
@@ -818,7 +819,6 @@ const b = {
y: SPEED * Math.sin(ANGLE) y: SPEED * Math.sin(ANGLE)
}); });
World.add(engine.world, bullet[bIndex]); //add bullet to world World.add(engine.world, bullet[bIndex]); //add bullet to world
} }
} }
@@ -827,7 +827,7 @@ const b = {
{ {
name: "drones", name: "drones",
ammo: 0, ammo: 0,
ammoPack: 21, ammoPack: 40,
have: false, have: false,
fire() { fire() {
const MAX_SPEED = 7 const MAX_SPEED = 7
@@ -839,7 +839,7 @@ const b = {
friction: 0, friction: 0,
frictionAir: 0.002, frictionAir: 0.002,
restitution: 0.6, restitution: 0.6,
dmg: 0.4, //damage done in addition to the damage from momentum dmg: 0.2, //damage done in addition to the damage from momentum
lookFrequency: 27 + Math.floor(17 * Math.random()), lookFrequency: 27 + Math.floor(17 * Math.random()),
endCycle: game.cycle + 480, endCycle: game.cycle + 480,
classType: "bullet", classType: "bullet",
@@ -879,6 +879,7 @@ const b = {
this.close = mob[i].position; this.close = mob[i].position;
closeDist = dist; closeDist = dist;
this.lockedOn = Matter.Vector.normalise(targetVector); this.lockedOn = Matter.Vector.normalise(targetVector);
if (0.3 > Math.random()) break //doesn't always target the closest mob
} }
} }
} }

View File

@@ -13,7 +13,7 @@ const level = {
// game.zoomScale = 1400 //1400 // game.zoomScale = 1400 //1400
if (game.levelsCleared === 0) { if (game.levelsCleared === 0) {
this.intro(); //starting level this.intro(); //starting level
// b.giveGuns(11) // set a starting gun for testing b.giveGuns(11) // set a starting gun for testing
// game.levelsCleared = 3; //for testing to simulate all possible mobs spawns // game.levelsCleared = 3; //for testing to simulate all possible mobs spawns
// this.bosses(); // this.bosses();
// this.testingMap(); // this.testingMap();