wording, and spore balance

This commit is contained in:
lilgreenland
2019-09-20 07:09:23 -07:00
parent f92114ffea
commit 8945dfa01b
3 changed files with 35 additions and 254 deletions

View File

@@ -767,13 +767,13 @@ const b = {
{ {
name: "spores", name: "spores",
ammo: 0, ammo: 0,
ammoPack: 7, ammoPack: 6,
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.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] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, 4.5, b.fireAttributes(dir));
b.fireProps(mech.crouch ? 60 : 35, mech.crouch ? 25 : 14, dir, me); //cd , speed b.fireProps(mech.crouch ? 70 : 50, mech.crouch ? 25 : 14, 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 + 100; bullet[me].endCycle = game.cycle + 100;
@@ -798,7 +798,7 @@ const b = {
//spawn bullets on end //spawn bullets on end
bullet[me].onEnd = function () { bullet[me].onEnd = function () {
const NUM = 12; const NUM = 9;
for (let i = 0; i < NUM; i++) { for (let i = 0; i < NUM; i++) {
const bIndex = bullet.length; const bIndex = bullet.length;
const RADIUS = 4 + 2 * Math.random(); const RADIUS = 4 + 2 * Math.random();
@@ -808,7 +808,7 @@ const b = {
angle: dir, angle: dir,
friction: 0, friction: 0,
frictionAir: 0.01, frictionAir: 0.01,
dmg: 1, //damage done in addition to the damage from momentum dmg: 1.65, //damage done in addition to the damage from momentum
classType: "bullet", classType: "bullet",
collisionFilter: { collisionFilter: {
category: 0x000100, category: 0x000100,
@@ -820,7 +820,7 @@ const b = {
this.endCycle = 0; //bullet ends cycle after doing damage this.endCycle = 0; //bullet ends cycle after doing damage
}, },
onEnd() {}, onEnd() {},
lookFrequency: 57 + Math.floor(37 * Math.random()), lookFrequency: 67 + Math.floor(47 * Math.random()),
do() { do() {
this.force.y += this.mass * 0.00025; // high gravity because of the high friction this.force.y += this.mass * 0.00025; // high gravity because of the high friction

View File

@@ -15,7 +15,7 @@ const level = {
document.title = "n-gon"; document.title = "n-gon";
this.intro(); //starting level this.intro(); //starting level
// b.giveGuns(0) // set a starting gun for testing // b.giveGuns(0) // set a starting gun for testing
mech.fieldUpgrades[4]() //give a field power up for testing mech.fieldUpgrades[6]() //give a field power up for testing
// game.levelsCleared = 3; //for testing to simulate possible mobs spawns // game.levelsCleared = 3; //for testing to simulate possible mobs spawns
// this.bosses(); // this.bosses();
// this.testingMap(); // this.testingMap();

View File

@@ -817,7 +817,7 @@ const mech = {
}, },
() => { () => {
mech.fieldMode = 1; mech.fieldMode = 1;
game.makeTextLog("<strong style='font-size:30px;'>Time Dilation Field</strong><br> (left mouse or space bar)<p> field emitter slows objects in range</p>", 1000); game.makeTextLog("<strong style='font-size:30px;'>Time Dilation Field</strong><br> (right mouse or space bar)<p> field emitter slows objects in range</p>", 1000);
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.fieldArc = 1; //field covers full 360 degrees mech.fieldArc = 1; //field covers full 360 degrees
mech.calculateFieldThreshold(); mech.calculateFieldThreshold();
@@ -872,7 +872,7 @@ const mech = {
}, },
() => { () => {
mech.fieldMode = 2; mech.fieldMode = 2;
game.makeTextLog("<strong style='font-size:30px;'>Kinetic Energy Field</strong><br> (left mouse or space bar)<p> field emitter does damage on contact<br> blocks are thrown at a higher velocity</p>", 1000); game.makeTextLog("<strong style='font-size:30px;'>Kinetic Energy Field</strong><br> (right mouse or space bar)<p> field emitter does damage on contact<br> blocks are thrown at a higher velocity</p>", 1000);
mech.setHoldDefaults(); mech.setHoldDefaults();
//throw quicker and harder //throw quicker and harder
mech.throwChargeRate = 3; //0.5 mech.throwChargeRate = 3; //0.5
@@ -922,7 +922,7 @@ const mech = {
}, },
() => { () => {
mech.fieldMode = 3; mech.fieldMode = 3;
game.makeTextLog("<strong style='font-size:30px;'>Negative Mass Field</strong><br> (left mouse or space bar)<p> field emitter nullifies gravity around player<br> field emitter holds more massive objects</p>", 1000); game.makeTextLog("<strong style='font-size:30px;'>Negative Mass Field</strong><br> (right mouse or space bar)<p> field emitter nullifies gravity around player<br> field emitter holds more massive objects</p>", 1000);
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.holdingMassScale = 0.05; //can hold heavier blocks mech.holdingMassScale = 0.05; //can hold heavier blocks
mech.fieldArc = 1; //field covers full 360 degrees mech.fieldArc = 1; //field covers full 360 degrees
@@ -983,14 +983,14 @@ const mech = {
}, },
() => { () => {
mech.fieldMode = 4; mech.fieldMode = 4;
game.makeTextLog("<strong style='font-size:30px;'>Zero-Point Energy Field</strong><br> (left mouse or space bar) <p>improved energy regeneration<br> field emitter surrounds player</p>", 1000); game.makeTextLog("<strong style='font-size:30px;'>Zero-Point Energy Field</strong><br> (right mouse or space bar) <p>improved energy regeneration<br> field emitter surrounds player</p>", 1000);
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.fieldRegen = 0.02; //0.0015 mech.fieldRegen = 0.01; //0.0015
mech.fieldArc = 1; //field covers full 360 degrees mech.fieldArc = 1; //field covers full 360 degrees
mech.calculateFieldThreshold(); mech.calculateFieldThreshold();
mech.hold = function () { mech.hold = function () {
mech.grabRange = 250 + 35 * Math.sin(game.cycle / 20) mech.grabRange = 190 + 35 * Math.sin(game.cycle / 30)
if (mech.isHolding) { if (mech.isHolding) {
mech.drawHold(mech.holdingTarget); mech.drawHold(mech.holdingTarget);
@@ -1011,12 +1011,14 @@ const mech = {
}, },
() => { () => {
mech.fieldMode = 5; mech.fieldMode = 5;
game.makeTextLog("<strong style='font-size:30px;'>Nano-Scale Manufacturing</strong><br> (passive effect) <p>when energy is full, build a drone using 10 energy<br> reduced energy regeneration</p>", 1000); game.makeTextLog("<strong style='font-size:30px;'>Nano-Scale Manufacturing</strong><br> (passive effect) <p>when energy is full, build a drone using 20 energy</p>", 1000);
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.fieldRegen = 0.0005 //0.0015; mech.grabRange = 160;
mech.fieldArc = 0.11;
// mech.fieldRegen = 0.0008 //0.0015;
mech.hold = function () { mech.hold = function () {
if (mech.fieldMeter === 1) { if (mech.fieldMeter === 1) {
mech.fieldMeter -= 0.1; mech.fieldMeter -= 0.2;
b.guns[12].fire() //spawn drone b.guns[12].fire() //spawn drone
} }
@@ -1025,9 +1027,23 @@ const mech = {
mech.holding(); mech.holding();
mech.throw(); mech.throw();
} else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.1)) { //not hold but field button is pressed } else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.1)) { //not hold but field button is pressed
mech.drawField(); // mech.drawField();
//draw field
const range = this.grabRange - 20;
ctx.beginPath();
ctx.arc(this.pos.x, this.pos.y, range, this.angle - Math.PI * this.fieldArc, this.angle + Math.PI * this.fieldArc, false);
let eye = 13;
ctx.lineTo(mech.pos.x + eye * Math.cos(this.angle), mech.pos.y + eye * Math.sin(this.angle));
if (this.holdingTarget) {
ctx.fillStyle = "rgba(150,150,150," + (0.05 + 0.1 * Math.random()) + ")";
} else {
ctx.fillStyle = "rgba(150,150,150," + (0.15 + 0.15 * Math.random()) + ")";
}
ctx.fill();
mech.grabPowerUp(); mech.grabPowerUp();
mech.pushMobs(); // mech.pushMobs();
mech.lookForPickUp(); mech.lookForPickUp();
} else if (mech.holdingTarget && mech.fireCDcycle < game.cycle) { //holding, but field button is released } else if (mech.holdingTarget && mech.fireCDcycle < game.cycle) { //holding, but field button is released
mech.pickUp(); mech.pickUp();
@@ -1039,7 +1055,7 @@ const mech = {
}, },
() => { () => {
mech.fieldMode = 6; mech.fieldMode = 6;
game.makeTextLog("<strong style='font-size:30px;'>Metamaterial Refractive Optics</strong><br> (left mouse or space bar) <p>localized invisibility field</p>", 1000); game.makeTextLog("<strong style='font-size:30px;'>Metamaterial Refractive Optics</strong><br> (right mouse or space bar) <p>localized invisibility field</p>", 1000);
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.fieldArc = 1; //field covers full 360 degrees mech.fieldArc = 1; //field covers full 360 degrees
mech.calculateFieldThreshold(); mech.calculateFieldThreshold();
@@ -1079,242 +1095,7 @@ const mech = {
} }
mech.drawFieldMeter() mech.drawFieldMeter()
} }
}, }
// () => {
// mech.fieldMode = 1;
// game.makeTextLog("<h2>Time Dilation Field</h2><br><strong>active ability:</strong> hold left and right mouse to slow time<br><strong>passive bonus:</strong> +field regeneration", 1000); //<br><strong>passive bonus:</strong> can phase through blocks
// mech.setHoldDefaults();
// mech.fieldRegen = 0.01; //0.0015
// mech.hold = function () {
// if (mech.isHolding) {
// mech.drawHold(mech.holdingTarget);
// mech.holding();
// mech.throw();
// } else if (game.mouseDown && (keys[32] || game.mouseDownRight) && mech.fieldCDcycle < game.cycle) {
// if (mech.fieldMeter > mech.fieldRegen * 1.15) {
// mech.fieldMeter -= mech.fieldRegen * 1.15;
// const range = 900;
// //draw slow field
// ctx.beginPath();
// ctx.arc(mech.pos.x, mech.pos.y, range, 0, 2 * Math.PI);
// ctx.fillStyle = "#f5f5ff";
// ctx.globalCompositeOperation = "difference";
// ctx.fill();
// ctx.globalCompositeOperation = "source-over";
// function slow(who, friction = 0) {
// for (let i = 0, len = who.length; i < len; ++i) {
// dist = Matter.Vector.magnitude(Matter.Vector.sub(who[i].position, mech.pos))
// if (dist < range) {
// Matter.Body.setAngularVelocity(who[i], who[i].angularVelocity * friction)
// Matter.Body.setVelocity(who[i], {
// x: who[i].velocity.x * friction,
// y: who[i].velocity.y * friction
// });
// }
// }
// }
// slow(mob);
// slow(body);
// slow(bullet);
// } else {
// mech.fieldCDcycle = game.cycle + 120;
// }
// } else if ((keys[32] || game.mouseDownRight) && mech.fieldMeter > 0.1) { //field button is pressed
// mech.drawField();
// mech.grabPowerUp();
// mech.pushMobs();
// mech.lookForPickUp(130);
// } else if (mech.holdingTarget && mech.fireCDcycle < game.cycle) { //holding, but field button is released
// mech.pickUp();
// } else {
// 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.drawFieldMeter()
// }
// },
// () => {
// mech.fieldMode = 2;
// game.makeTextLog("<h2>Kinetic Energy Field</h2><br><strong>passive bonus:</strong> +field emitter damage<br><strong>passive bonus:</strong> +throw energy", 1000);
// mech.setHoldDefaults();
// // mech.fieldRegen = 0.0008; // 0.0015 is normal
// //throw quicker and harder
// mech.throwChargeRate = 4; //0.5
// mech.throwChargeMax = 300; //50
// //passive field does extra damage
// mech.grabRange = 180;
// mech.fieldArc = 0.08;
// mech.fieldDamage = 2.5;
// mech.hold = function () {
// if (mech.isHolding) {
// mech.drawHold(mech.holdingTarget);
// mech.holding();
// mech.throw();
// } else if ((keys[32] || game.mouseDownRight) && mech.fieldMeter > 0.15) { //not hold but field button is pressed
// //draw field
// const range = mech.grabRange - 20;
// ctx.beginPath();
// ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - Math.PI * mech.fieldArc, mech.angle + Math.PI * mech.fieldArc, false);
// let eye = 13;
// ctx.lineTo(mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle));
// if (mech.holdingTarget) {
// ctx.fillStyle = "rgba(255,50,150," + (0.05 + 0.1 * Math.random()) + ")";
// } else {
// ctx.fillStyle = "rgba(255,50,150," + (0.15 + 0.15 * Math.random()) + ")";
// }
// ctx.fill();
// //draw random lines in field for cool effect
// let offAngle = mech.angle + 2 * Math.PI * mech.fieldArc * (Math.random() - 0.5);
// ctx.beginPath();
// eye = 15;
// ctx.moveTo(mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle));
// ctx.lineTo(mech.pos.x + range * Math.cos(offAngle), mech.pos.y + range * Math.sin(offAngle));
// ctx.strokeStyle = "rgba(120,170,255,0.4)";
// ctx.stroke();
// mech.grabPowerUp();
// mech.pushMobs();
// mech.lookForPickUp();
// } else if (mech.holdingTarget && mech.fireCDcycle < game.cycle) { //holding, but field button is released
// mech.pickUp();
// } else {
// 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.drawFieldMeter()
// }
// },
// () => {
// mech.fieldMode = 3;
// game.makeTextLog("<h2>Mass Recycler</h2><br><strong>active ability:</strong> hold left and right mouse to convert blocks into health<br><strong>negative effect:</strong> -energy regen", 1000);
// mech.setHoldDefaults();
// mech.fieldRegen = 0.0005; //0.0015
// mech.hold = function () {
// // health drain
// // if (game.cycle % 360 === 0 && mech.health > 0.2) {
// // mech.health = mech.health * 0.97 - 0.01;
// // if (mech.health < 0) {
// // mech.health = 0;
// // mech.death();
// // return;
// // }
// // mech.displayHealth();
// // }
// if (mech.isHolding) {
// mech.drawHold(mech.holdingTarget);
// mech.holding();
// mech.throw();
// } else if (game.mouseDown && (keys[32] || game.mouseDownRight) && mech.fieldCDcycle < game.cycle) {
// if (mech.fieldMeter > mech.fieldRegen) {
// // mech.fieldMeter -= mech.fieldRegen
// const range = 165;
// //draw range
// ctx.globalCompositeOperation = "screen" //"lighter" // "destination-atop" //"difference" //"color-burn";
// ctx.beginPath();
// ctx.arc(mech.pos.x, mech.pos.y, range, 0, 2 * Math.PI);
// ctx.lineWidth = 1;
// ctx.fillStyle = "rgba(150,210,180," + (0.9 + Math.random() * 0.1) + ")";
// ctx.fill();
// ctx.globalCompositeOperation = "source-over";
// ctx.strokeStyle = "#364";
// ctx.stroke();
// //find all blocks in range
// for (let i = 0, len = body.length; i < len; i++) {
// if (!body[i].isNotHoldable) {
// dist = Matter.Vector.magnitude(Matter.Vector.sub(body[i].position, mech.pos))
// const healCost = Math.sqrt(0.003 * body[i].mass) + 0.04
// if (dist < range && mech.fieldMeter > healCost + 0.2) { // convert block to heal power up
// // mech.fieldCDcycle = game.cycle + 4;
// mech.fieldMeter -= healCost
// powerUps.spawnHeal(body[i].position.x, body[i].position.y, 120 * healCost);
// Matter.World.remove(engine.world, body[i]);
// body.splice(i, 1);
// break
// }
// }
// }
// } else {
// mech.fieldCDcycle = game.cycle + 120;
// }
// } else if ((keys[32] || game.mouseDownRight) && mech.fieldMeter > 0.2) { //field button is pressed
// mech.drawField();
// mech.grabPowerUp();
// mech.pushMobs();
// mech.lookForPickUp(130);
// } else if (mech.holdingTarget && mech.fireCDcycle < game.cycle) { //holding, but field button is released
// mech.pickUp();
// } else {
// 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.drawFieldMeter()
// }
// },
// () => {
// mech.fieldMode = 4;
// game.makeTextLog("<h2>Negative Mass Field</h2><br><strong>active ability:</strong> hold left and right mouse to nullify gravity<br><strong>passive bonuses:</strong> +field size, +hold larger blocks", 1000);
// mech.setHoldDefaults();
// mech.fieldArc = 1; //field covers full 360 degrees
// mech.calculateFieldThreshold();
// mech.holdingMassScale = 0.05; //can hold heavier blocks
// // mech.gravity = 0.0015; //passive reduce gravity from default 0.0019
// mech.hold = function () {
// const range = 200 + 35 * Math.sin(game.cycle / 20)
// if (mech.isHolding) {
// mech.drawHold(mech.holdingTarget);
// mech.holding();
// mech.throw();
// } else if (game.mouseDown && (keys[32] || game.mouseDownRight) && mech.fieldCDcycle < game.cycle) { //push away
// if (mech.fieldMeter > 0.005) {
// mech.fieldMeter -= 0.005;
// //look for nearby objects to make zero-g
// function zeroG(who) {
// for (let i = 0, len = who.length; i < len; ++i) {
// sub = Matter.Vector.sub(who[i].position, mech.pos);
// dist = Matter.Vector.magnitude(sub);
// if (dist < range) {
// who[i].force.y -= who[i].mass * game.g;
// }
// }
// }
// zeroG(powerUp);
// zeroG(body);
// player.force.y -= player.mass * mech.gravity; // + 0.005 * Math.sin(game.cycle / 10); //wobble
// //add player vertical friction to reduce map jump craziness
// Matter.Body.setVelocity(player, {
// x: player.velocity.x,
// y: player.velocity.y * 0.99
// });
// //draw zero-G range
// ctx.beginPath();
// ctx.arc(mech.pos.x, mech.pos.y + 15, range, 0, 2 * Math.PI);
// ctx.globalCompositeOperation = "color-burn";
// ctx.fillStyle = "rgb(90,90,100)";
// ctx.fill();
// ctx.globalCompositeOperation = "source-over";
// } else {
// //trigger cooldown
// mech.fieldCDcycle = game.cycle + 120;
// }
// } else if ((keys[32] || game.mouseDownRight) && mech.fieldMeter > 0.2 && mech.fieldCDcycle < game.cycle) { //not hold but field button is pressed
// mech.grabRange = range
// mech.drawField();
// mech.grabPowerUp();
// mech.pushMobs();
// mech.lookForPickUp();
// } else if (mech.holdingTarget && mech.fireCDcycle < game.cycle && mech.fieldCDcycle < game.cycle) { //holding, but field button is released
// mech.pickUp();
// } else {
// 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.drawFieldMeter()
// }
// },
], ],
drawLeg(stroke) { drawLeg(stroke) {
// if (game.mouseInGame.x > this.pos.x) { // if (game.mouseInGame.x > this.pos.x) {