launcher rework; wave, minigun balance

This commit is contained in:
landgreen
2020-05-23 11:17:27 -07:00
parent b053269e71
commit e265b0aade
8 changed files with 270 additions and 302 deletions

View File

@@ -798,7 +798,6 @@ const b = {
const SCALE = 1.06 const SCALE = 1.06
Matter.Body.scale(this, SCALE, SCALE); Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE; this.radius *= SCALE;
console.log(this.radius)
} else { } else {
//shrink //shrink
const SCALE = 1 - 0.005 / mod.isBulletsLastLonger const SCALE = 1 - 0.005 / mod.isBulletsLastLonger
@@ -1164,28 +1163,20 @@ const b = {
isEasyToAim: false, isEasyToAim: false,
fire() { fire() {
const me = bullet.length; const me = bullet.length;
const dir = mech.angle + (Math.random() - 0.5) * ((mech.crouch) ? 0.03 : 0.1); const dir = mech.angle + (Math.random() - 0.5) * ((mech.crouch) ? 0.01 : 0.1);
bullet[me] = Bodies.rectangle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20 * mod.bulletSize, 6 * mod.bulletSize, b.fireAttributes(dir)); bullet[me] = Bodies.rectangle(mech.pos.x + 23 * Math.cos(mech.angle), mech.pos.y + 23 * Math.sin(mech.angle), 20 * mod.bulletSize, 6 * mod.bulletSize, b.fireAttributes(dir));
b.fireProps(mech.crouch ? 8 : 4, mech.crouch ? 52 : 38, dir, me); //cd , speed b.fireProps(mech.crouch ? 7 : 4, mech.crouch ? 40 : 34, dir, me); //cd , speed
bullet[me].endCycle = game.cycle + 70; bullet[me].endCycle = game.cycle + 70;
bullet[me].dmg = 0.07; bullet[me].dmg = 0.25;
bullet[me].frictionAir = mech.crouch ? 0.007 : 0.01; bullet[me].frictionAir = mech.crouch ? 0.001 : 0.003;
if (mod.isIceCrystals && mech.energy > 0.01) { if (mod.isIceCrystals && mech.energy > 0.01) {
mech.energy -= mech.fieldRegen + 0.007 mech.energy -= mech.fieldRegen + 0.005
bullet[me].onDmg = function (who) { bullet[me].onDmg = function (who) {
mobs.statusSlow(who, 30) mobs.statusSlow(who, 30)
}; };
//ice muzzleFlash
ctx.fillStyle = "rgb(0,100,255)";
ctx.beginPath();
ctx.arc(mech.pos.x + 35 * Math.cos(mech.angle), mech.pos.y + 35 * Math.sin(mech.angle), 15, 0, 2 * Math.PI);
ctx.fill();
} else {
b.muzzleFlash(15);
} }
bullet[me].do = function () { bullet[me].do = function () {
this.force.y += this.mass * 0.0005; this.force.y += this.mass * 0.0003;
}; };
} }
}, },
@@ -1425,7 +1416,7 @@ const b = {
for (let i = 0; i < q.length; i++) { for (let i = 0; i < q.length; i++) {
slowCheck = 0.3; slowCheck = 0.3;
Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium
let dmg = b.dmgScale * 0.43 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.6) //1 - 0.4 = 0.6 for helix mod 40% damage reduction let dmg = b.dmgScale * 0.37 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.6) //1 - 0.4 = 0.6 for helix mod 40% damage reduction
q[i].damage(dmg); q[i].damage(dmg);
q[i].foundPlayer(); q[i].foundPlayer();
game.drawList.push({ //add dmg to draw queue game.drawList.push({ //add dmg to draw queue
@@ -1443,7 +1434,6 @@ const b = {
Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(this.velocity), SPEED * slowCheck)); Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(this.velocity), SPEED * slowCheck));
} }
} }
this.cycle++ this.cycle++
const wiggle = Vector.mult(transverse, wiggleMag * Math.cos(this.cycle * 0.35) * ((i % 2) ? -1 : 1)) const wiggle = Vector.mult(transverse, wiggleMag * Math.cos(this.cycle * 0.35) * ((i % 2) ? -1 : 1))
Matter.Body.setPosition(this, Vector.add(this.position, wiggle)) Matter.Body.setPosition(this, Vector.add(this.position, wiggle))

View File

@@ -184,7 +184,7 @@ const level = {
// spawn.bomberBoss(2900, -500) // spawn.bomberBoss(2900, -500)
spawn.launcherBoss(1200, -500) spawn.launcherBoss(1200, -500)
// spawn.launcher(1600, -400) spawn.launcher(1600, -400)
// spawn.spawner(1600, -500) // spawn.spawner(1600, -500)
// spawn.cellBossCulture(1600, -500) // spawn.cellBossCulture(1600, -500)
// spawn.shooter(1600, -500) // spawn.shooter(1600, -500)

View File

@@ -187,7 +187,7 @@ const mobs = {
index: i, index: i,
health: 1, health: 1,
showHealthBar: true, showHealthBar: true,
accelMag: 0.001, accelMag: 0.001 * game.accelScale,
cd: 0, //game cycle when cooldown will be over cd: 0, //game cycle when cooldown will be over
delay: 60, //static: time between cooldowns delay: 60, //static: time between cooldowns
fill: color, fill: color,

View File

@@ -44,6 +44,25 @@ const mod = {
game.updateModHUD(); game.updateModHUD();
} }
}, },
giveBasicMod(index = 'random') {
// if (isNaN(index)) { //find index by name
// let found = false;
// for (let i = 0; i < mod.mods.length; i++) {
// if (index === mod.mods[i].name) {
// index = i;
// found = true;
// break;
// }
// }
// if (!found) return //if name not found don't give any mod
// }
mod.basicMods[index].effect(); //give specific mod
mod.mods[index].count++
mod.totalCount++ //used in power up randomization
game.updateModHUD();
},
haveGunCheck(name) { haveGunCheck(name) {
for (i = 0, len = b.inventory.length; i < len; i++) { for (i = 0, len = b.inventory.length; i < len; i++) {
if (b.guns[b.inventory[i]].name === name) return true if (b.guns[b.inventory[i]].name === name) return true
@@ -90,6 +109,7 @@ const mod = {
if (document.getElementById("mod-low-health-damage")) document.getElementById("mod-low-health-damage").innerHTML = ""; if (document.getElementById("mod-low-health-damage")) document.getElementById("mod-low-health-damage").innerHTML = "";
}, 10); }, 10);
}, },
mods: [{ mods: [{
name: "capacitor", name: "capacitor",
// nameInfo: "<span id='mod-capacitor'></span>", // nameInfo: "<span id='mod-capacitor'></span>",
@@ -156,26 +176,6 @@ const mod = {
mod.isCrit = false; mod.isCrit = false;
} }
}, },
{
name: "fluoroantimonic acid",
nameInfo: "<span id='mod-acid'></span>",
description: "each <strong>bullet</strong> does instant <strong class='color-p'>acid</strong> <strong class='color-d'>damage</strong><br><strong>active</strong> when you are above <strong>80%</strong> base health",
maxCount: 1,
count: 0,
allowed() {
return mech.health > 0.8 || build.isCustomSelection
},
requires: "health above 80%",
effect() {
mod.isAcidDmg = true;
mod.onHealthChange();
},
remove() {
mod.acidDmg = 0;
mod.isAcidDmg = false;
game.playerDmgColor = "rgba(0,0,0,0.7)"
}
},
{ {
name: "negative feedback", name: "negative feedback",
// nameInfo: "<span id='mod-low-health-damage'></span>", // nameInfo: "<span id='mod-low-health-damage'></span>",
@@ -929,6 +929,27 @@ const mod = {
mod.isDamageFromBulletCount = false mod.isDamageFromBulletCount = false
} }
}, },
{
name: "fluoroantimonic acid",
nameInfo: "<span id='mod-acid'></span>",
description: "each <strong>bullet</strong> does instant <strong class='color-p'>acid</strong> <strong class='color-d'>damage</strong><br><strong>active</strong> when you are above <strong>80%</strong> base health",
maxCount: 1,
count: 0,
allowed() {
return (mech.health > 0.8 || build.isCustomSelection) &&
(mod.haveGunCheck("mine") || mod.haveGunCheck("minigun") || mod.haveGunCheck("shotgun") || mod.haveGunCheck("super balls") || mod.haveGunCheck("spores") || mod.haveGunCheck("drones") || mod.haveGunCheck("ice IX"))
},
requires: "health above 80%",
effect() {
mod.isAcidDmg = true;
mod.onHealthChange();
},
remove() {
mod.acidDmg = 0;
mod.isAcidDmg = false;
game.playerDmgColor = "rgba(0,0,0,0.7)"
}
},
{ {
name: "depleted uranium rounds", name: "depleted uranium rounds",
description: `your <strong>bullets</strong> are <strong>+16%</strong> larger<br>increased mass and physical <strong class='color-d'>damage</strong>`, description: `your <strong>bullets</strong> are <strong>+16%</strong> larger<br>increased mass and physical <strong class='color-d'>damage</strong>`,

View File

@@ -358,15 +358,13 @@ const mech = {
alive: false, alive: false,
death() { death() {
if (mod.isImmortal) { //if player has the immortality buff, spawn on the same level with randomized stats if (mod.isImmortal) { //if player has the immortality buff, spawn on the same level with randomized stats
spawn.setSpawnList(); //new mob types
game.clearNow = true; //triggers a map reset
powerUps.reroll.rerolls = Math.floor(Math.random() * Math.random() * 12)
//count mods //count mods
let totalMods = 0; let totalMods = 0;
for (let i = 0; i < mod.mods.length; i++) { for (let i = 0; i < mod.mods.length; i++) {
totalMods += mod.mods[i].count totalMods += mod.mods[i].count
} }
const totalGuns = b.inventory.length //count guns
function randomizeMods() { function randomizeMods() {
for (let i = 0; i < totalMods; i++) { for (let i = 0; i < totalMods; i++) {
@@ -394,18 +392,16 @@ const mech = {
} }
function randomizeField() { function randomizeField() {
mech.setField(Math.floor(Math.random() * (mech.fieldUpgrades.length))) mech.setField(Math.ceil(Math.random() * (mech.fieldUpgrades.length - 1)))
} }
function randomizeHealth() { function randomizeHealth() {
mech.health = 0.6 + Math.random() mech.health = 0.7 + Math.random()
if (mech.health > 1) mech.health = 1; if (mech.health > 1) mech.health = 1;
mech.displayHealth(); mech.displayHealth();
} }
function randomizeGuns() { function randomizeGuns() {
// const length = Math.round(b.inventory.length * (1 + 0.4 * (Math.random() - 0.5)))
const length = b.inventory.length
//removes guns and ammo //removes guns and ammo
b.inventory = []; b.inventory = [];
b.activeGun = null; b.activeGun = null;
@@ -415,11 +411,11 @@ const mech = {
if (b.guns[i].ammo !== Infinity) b.guns[i].ammo = 0; if (b.guns[i].ammo !== Infinity) b.guns[i].ammo = 0;
} }
//give random guns //give random guns
for (let i = 0; i < length; i++) b.giveGuns() for (let i = 0; i < totalGuns; i++) b.giveGuns()
//randomize ammo //randomize ammo
for (let i = 0, len = b.inventory.length; i < len; i++) { for (let i = 0, len = b.inventory.length; i < len; i++) {
if (b.guns[b.inventory[i]].ammo !== Infinity) { if (b.guns[b.inventory[i]].ammo !== Infinity) {
b.guns[b.inventory[i]].ammo = Math.max(0, Math.floor(5 * b.guns[b.inventory[i]].ammo * (Math.random() - 0.1))) b.guns[b.inventory[i]].ammo = Math.max(0, Math.floor(6 * b.guns[b.inventory[i]].ammo * Math.sqrt(Math.random())))
} }
} }
game.makeGunHUD(); //update gun HUD game.makeGunHUD(); //update gun HUD
@@ -431,6 +427,9 @@ const mech = {
} }
function randomizeEverything() { function randomizeEverything() {
spawn.setSpawnList(); //new mob types
game.clearNow = true; //triggers a map reset
mod.setupAllMods(); //remove all mods mod.setupAllMods(); //remove all mods
for (let i = 0; i < bullet.length; ++i) Matter.World.remove(engine.world, bullet[i]); for (let i = 0; i < bullet.length; ++i) Matter.World.remove(engine.world, bullet[i]);
bullet = []; //remove all bullets bullet = []; //remove all bullets
@@ -442,7 +441,7 @@ const mech = {
randomizeEverything() randomizeEverything()
const swapPeriod = 1000 const swapPeriod = 1000
for (let i = 0, len = 7; i < len; i++) { for (let i = 0, len = 5; i < len; i++) {
setTimeout(function () { setTimeout(function () {
randomizeEverything() randomizeEverything()
game.replaceTextLog = true; game.replaceTextLog = true;
@@ -460,7 +459,7 @@ const mech = {
} }
game.replaceTextLog = true; game.replaceTextLog = true;
game.makeTextLog("your quantum probability has stabilized", 1000); game.makeTextLog("your quantum probability has stabilized", 1000);
}, 8 * swapPeriod); }, 6 * swapPeriod);
} else if (mech.alive) { //normal death code here } else if (mech.alive) { //normal death code here
mech.alive = false; mech.alive = false;
@@ -1873,10 +1872,13 @@ const mech = {
mech.drawHold(mech.holdingTarget); mech.drawHold(mech.holdingTarget);
mech.holding(); mech.holding();
mech.throwBlock(); mech.throwBlock();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { } else if (keys[32] || game.mouseDownRight) {
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(); mech.lookForPickUp();
if (mech.fieldCDcycle < mech.cycle) {
const DRAIN = 0.0003 + 0.00015 * player.speed + ((!mod.renormalization && mech.fireCDcycle > mech.cycle) ? 0.005 : 0.001) const DRAIN = 0.0003 + 0.00015 * player.speed + ((!mod.renormalization && mech.fireCDcycle > mech.cycle) ? 0.005 : 0.001)
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
@@ -1930,6 +1932,7 @@ const mech = {
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists) mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
drawField(this.fieldRange) drawField(this.fieldRange)
} }
}
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle) { //holding, but field button is released } else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle) { //holding, but field button is released
mech.pickUp(); mech.pickUp();
if (this.fieldRange < 2000) { if (this.fieldRange < 2000) {
@@ -1983,7 +1986,8 @@ const mech = {
mech.fieldRadius = 0; mech.fieldRadius = 0;
mech.drop(); mech.drop();
mech.hold = function () { mech.hold = function () {
if ((keys[32] || game.mouseDownRight && mech.fieldCDcycle < mech.cycle)) { if (keys[32] || game.mouseDownRight) {
if (mech.fieldCDcycle < mech.cycle) {
const scale = 25 const scale = 25
const bounds = { const bounds = {
min: { min: {
@@ -2044,6 +2048,8 @@ const mech = {
} }
} }
} }
//grab power ups normally too
mech.grabPowerUp();
if (mech.energy > 0.01) { if (mech.energy > 0.01) {
//find mouse velocity //find mouse velocity
@@ -2106,6 +2112,9 @@ const mech = {
mech.fieldOn = false mech.fieldOn = false
mech.fieldRadius = 0 mech.fieldRadius = 0
} }
} else {
mech.grabPowerUp();
}
} else { } else {
mech.fieldOn = false mech.fieldOn = false
mech.fieldRadius = 0 mech.fieldRadius = 0

View File

@@ -211,6 +211,8 @@ const powerUps = {
}, },
choiceLog: [], //records all previous choice options choiceLog: [], //records all previous choice options
effect() { effect() {
function pick(skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) { function pick(skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) {
let options = []; let options = [];
for (let i = 0; i < mod.mods.length; i++) { for (let i = 0; i < mod.mods.length; i++) {
@@ -232,28 +234,30 @@ const powerUps = {
} }
} }
} }
if (options.length > 0) { if (options.length > 0) {
return options[Math.floor(Math.random() * options.length)] const choose = options[Math.floor(Math.random() * options.length)]
} text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choose})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choose].name}</div> ${mod.mods[choose].description}</div>`
return choose
} }
}
let text = `<div class='cancel' onclick='powerUps.endDraft()'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a mod</h3>`
let choice1 = pick() let choice1 = pick()
let choice2 = -1 let choice2 = -1
let choice3 = -1 let choice3 = -1
if (choice1 > -1) { if (choice1 > -1) {
let text = `<div class='cancel' onclick='powerUps.endDraft()'>✕</div><h3 style = 'color:#fff; text-align:left; margin: 0px;'>choose a mod</h3>`
text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice1})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice1].name}</div> ${mod.mods[choice1].description}</div>`
if (!mod.isDeterminism) { if (!mod.isDeterminism) {
choice2 = pick(choice1) choice2 = pick(choice1)
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice2})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice2].name}</div> ${mod.mods[choice2].description}</div>` // if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice2})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice2].name}</div> ${mod.mods[choice2].description}</div>`
choice3 = pick(choice1, choice2) choice3 = pick(choice1, choice2)
if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice3})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice3].name}</div> ${mod.mods[choice3].description}</div>` // if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice3})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice3].name}</div> ${mod.mods[choice3].description}</div>`
} }
if (mod.isExtraChoice) { if (mod.isExtraChoice) {
let choice4 = pick(choice1, choice2, choice3) let choice4 = pick(choice1, choice2, choice3)
if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice4})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice4].name}</div> ${mod.mods[choice4].description}</div>` // if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice4})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice4].name}</div> ${mod.mods[choice4].description}</div>`
let choice5 = pick(choice1, choice2, choice3, choice4) let choice5 = pick(choice1, choice2, choice3, choice4)
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice5})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice5].name}</div> ${mod.mods[choice5].description}</div>` // if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('mod',${choice5})"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${mod.mods[choice5].name}</div> ${mod.mods[choice5].description}</div>`
powerUps.mod.choiceLog.push(choice4) powerUps.mod.choiceLog.push(choice4)
powerUps.mod.choiceLog.push(choice5) powerUps.mod.choiceLog.push(choice5)
} }

View File

@@ -1440,38 +1440,22 @@ const spawn = {
launcher(x, y, radius = 30 + Math.ceil(Math.random() * 40)) { launcher(x, y, radius = 30 + Math.ceil(Math.random() * 40)) {
mobs.spawn(x, y, 3, radius, "rgb(150,150,255)"); mobs.spawn(x, y, 3, radius, "rgb(150,150,255)");
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
me.accelMag = 0.00002 * game.accelScale; me.accelMag = 0.00004 * game.accelScale;
me.fireFreq = Math.floor(420 + 90 * Math.random() * game.CDScale)
me.frictionStatic = 0; me.frictionStatic = 0;
me.friction = 0; me.friction = 0;
// me.memory = 200; me.frictionAir = 0.02;
me.delay = 770 * game.CDScale;
me.cd = Infinity;
spawn.shield(me, x, y); spawn.shield(me, x, y);
me.onDamage = function () {}; me.onDamage = function () {};
me.do = function () { me.do = function () {
if (!(game.cycle % this.seePlayerFreq)) { // this.seePlayerCheck(); from mobs this.seePlayerCheck();
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
!mech.isStealth
) {
this.foundPlayer();
if (this.cd === Infinity) this.cd = game.cycle + this.delay * 0.3;
} else if (this.seePlayer.recall) {
this.lostPlayer();
this.cd = Infinity
}
}
this.checkStatus(); this.checkStatus();
this.attraction(); this.attraction();
if (this.seePlayer.recall && this.cd < game.cycle) { if (this.seePlayer.recall && !(game.cycle % this.fireFreq)) {
this.cd = game.cycle + this.delay;
// this.torque += 0.0002 * this.inertia;
Matter.Body.setAngularVelocity(this, 0.14) Matter.Body.setAngularVelocity(this, 0.14)
//fire a bullet from each vertex //fire a bullet from each vertex
for (let i = 0, len = this.vertices.length; i < len; i++) { for (let i = 0, len = this.vertices.length; i < len; i++) {
spawn.seeker(this.vertices[i].x, this.vertices[i].y, 5) spawn.seeker(this.vertices[i].x, this.vertices[i].y, 6)
//give the bullet a rotational velocity as if they were attached to a vertex //give the bullet a rotational velocity as if they were attached to a vertex
const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, this.vertices[i]))), -8) const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, this.vertices[i]))), -8)
Matter.Body.setVelocity(mob[mob.length - 1], { Matter.Body.setVelocity(mob[mob.length - 1], {
@@ -1482,40 +1466,29 @@ const spawn = {
} }
}; };
}, },
launcherBoss(x, y, radius = 75 + Math.ceil(Math.random() * 20)) { launcherBoss(x, y, radius = 90) {
mobs.spawn(x, y, 7, radius, "rgb(150,150,255)"); mobs.spawn(x, y, 6, radius, "rgb(150,150,255)");
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
me.accelMag = 0.000065 * game.accelScale; me.accelMag = 0.00008 * game.accelScale;
me.memory = 720; me.fireFreq = Math.floor(330 * game.CDScale)
me.delay = 420 * game.CDScale; me.frictionStatic = 0;
me.cd = Infinity; me.friction = 0;
me.frictionAir = 0.02;
me.memory = 420 * game.CDScale;
me.repulsionRange = 1200000; //squared
spawn.shield(me, x, y, 1); spawn.shield(me, x, y, 1);
me.onDamage = function () {}; Matter.Body.setDensity(me, 0.004 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
Matter.Body.setDensity(me, 0.002 + 0.0002 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
me.onDeath = function () { me.onDeath = function () {
powerUps.spawnBossPowerUp(this.position.x, this.position.y) powerUps.spawnBossPowerUp(this.position.x, this.position.y)
// this.vertices = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices)) //helps collisions functions work better after vertex have been changed // this.vertices = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices)) //helps collisions functions work better after vertex have been changed
}; };
me.onDamage = function () {};
me.do = function () { me.do = function () {
if (!(game.cycle % this.seePlayerFreq)) { // this.seePlayerCheck(); from mobs this.seePlayerCheck();
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
!mech.isStealth
) {
this.foundPlayer();
if (this.cd === Infinity) this.cd = game.cycle + this.delay * 0.2;
} else if (this.seePlayer.recall) {
this.lostPlayer();
this.cd = Infinity
}
}
this.checkStatus(); this.checkStatus();
this.attraction(); this.attraction();
if (this.seePlayer.recall && this.cd < game.cycle) { this.repulsion();
this.cd = game.cycle + this.delay; if (this.seePlayer.recall && !(game.cycle % this.fireFreq)) {
// this.torque += 0.0002 * this.inertia;
Matter.Body.setAngularVelocity(this, 0.11) Matter.Body.setAngularVelocity(this, 0.11)
//fire a bullet from each vertex //fire a bullet from each vertex
for (let i = 0, len = this.vertices.length; i < len; i++) { for (let i = 0, len = this.vertices.length; i < len; i++) {
@@ -1530,17 +1503,17 @@ const spawn = {
} }
}; };
}, },
seeker(x, y, radius = 6, sides = 0) { seeker(x, y, radius = 5, sides = 0) {
//bullets //bullets
mobs.spawn(x, y, sides, radius, "rgb(0,0,255)"); mobs.spawn(x, y, sides, radius, "rgb(100,100,255)");
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
me.stroke = "transparent"; me.stroke = "transparent";
me.onHit = function () { me.onHit = function () {
this.explode(this.mass * 10); this.explode(this.mass * 10);
}; };
Matter.Body.setDensity(me, 0.00005); //normal is 0.001 Matter.Body.setDensity(me, 0.00005); //normal is 0.001
me.timeLeft = 380 * (0.8 + 0.4 * Math.random()); me.timeLeft = 420 * (0.8 + 0.4 * Math.random());
me.accelMag = 0.00012 * (0.8 + 0.4 * Math.random()) * game.accelScale; me.accelMag = 0.00015 * (0.8 + 0.4 * Math.random()) * game.accelScale;
me.frictionAir = 0.01 * (0.8 + 0.4 * Math.random()); me.frictionAir = 0.01 * (0.8 + 0.4 * Math.random());
me.restitution = 0.5; me.restitution = 0.5;
me.leaveBody = false; me.leaveBody = false;

View File

@@ -1,34 +1,6 @@
mob: launchers now have a new fire mechanic
mob: launcher boss
huge rework of code organization, this might produce some new bugs around mods
************** TODO - n-gon ************** ************** TODO - n-gon **************
launchers shouldn't have to face the player
fire after a spin
give bullets velocity from spin
mob boss - launcher
lower tier of basic mods
33% chance for basic mod on each selection
make an odds variable that starts at 0% and gains 33% for each normal mod, resets to 0% after get a basic mod
don't track these mods for avoiding no repeats
make ball different color to indicate quality
basic: grey? smaller size?
also make gun/field specific mods have a different icon for top tier
don't include basic mods in custom mod?
basic mods can show on guns or fields?
ideas
+5% damage
+8% haste
+5% damage reduction
+25% max health
+25% max energy
spawn 2 ammo //or 3?
spawn 2 heal
spawn 2 reroll //or 1?
movement fluidity movement fluidity
let legs jump on mobs, but player will still take damage let legs jump on mobs, but player will still take damage
like: ori and the blind forest, celeste like: ori and the blind forest, celeste
@@ -41,7 +13,6 @@ movement fluidity
wall grab? wall grab?
maybe remove falling damage and block damage? maybe remove falling damage and block damage?
rays can have width, how to use this? rays can have width, how to use this?
Matter.Query.ray(bodies, startPoint, endPoint, [rayWidth]) Matter.Query.ray(bodies, startPoint, endPoint, [rayWidth])
wide lasers? wide lasers?