wave beam balance
This commit is contained in:
@@ -900,21 +900,20 @@ const b = {
|
|||||||
{
|
{
|
||||||
name: "wave beam",
|
name: "wave beam",
|
||||||
ammo: 0,
|
ammo: 0,
|
||||||
ammoPack: 70,
|
ammoPack: 100,
|
||||||
have: false,
|
have: false,
|
||||||
fire() {
|
fire() {
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
const DIR = mech.angle
|
const DIR = mech.angle
|
||||||
const DIR_90 = mech.angle + Math.PI / 2
|
const wiggleMag = (mech.flipLegs === 1) ? 0.0045 : -0.0045
|
||||||
const MAG_90 = -26
|
bullet[me] = Bodies.circle(mech.pos.x + 25 * Math.cos(DIR), mech.pos.y + 25 * Math.sin(DIR), 5, {
|
||||||
bullet[me] = Bodies.circle(mech.pos.x + MAG_90 * Math.cos(DIR_90), mech.pos.y + MAG_90 * Math.sin(DIR_90), 5, {
|
|
||||||
angle: DIR,
|
angle: DIR,
|
||||||
cycle: -0.45, //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 + 300,
|
endCycle: game.cycle + 300,
|
||||||
inertia: Infinity,
|
inertia: Infinity,
|
||||||
frictionAir: 0,
|
frictionAir: 0,
|
||||||
minDmgSpeed: 0,
|
minDmgSpeed: 0,
|
||||||
dmg: 0.09, //damage done in addition to the damage from momentum
|
dmg: 0.1, //damage done in addition to the damage from momentum
|
||||||
classType: "bullet",
|
classType: "bullet",
|
||||||
collisionFilter: {
|
collisionFilter: {
|
||||||
category: 0x000100,
|
category: 0x000100,
|
||||||
@@ -924,19 +923,19 @@ const b = {
|
|||||||
// this.endCycle = 0; //bullet ends cycle after doing damage
|
// this.endCycle = 0; //bullet ends cycle after doing damage
|
||||||
|
|
||||||
//recalculate the direction of wiggle
|
//recalculate the direction of wiggle
|
||||||
this.direction = Matter.Vector.perp(this.velocity)
|
// this.direction = Matter.Vector.perp(this.velocity)
|
||||||
},
|
},
|
||||||
onEnd() {},
|
onEnd() {},
|
||||||
do() {
|
do() {
|
||||||
//wiggle wiggle wiggle
|
//wiggle wiggle wiggle
|
||||||
this.cycle++
|
this.cycle++
|
||||||
const THRUST = 0.003 * Math.cos(this.cycle * 0.3)
|
const THRUST = wiggleMag * Math.cos(this.cycle * 0.3)
|
||||||
this.force = Matter.Vector.mult(Matter.Vector.normalise(this.direction), this.mass * THRUST)
|
this.force = Matter.Vector.mult(Matter.Vector.normalise(this.direction), this.mass * THRUST)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
World.add(engine.world, bullet[me]); //add bullet to world
|
World.add(engine.world, bullet[me]); //add bullet to world
|
||||||
mech.fireCDcycle = game.cycle + 4; // cool down
|
mech.fireCDcycle = game.cycle + 3; // cool down
|
||||||
const SPEED = 5;
|
const SPEED = 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user