working on a new map
This commit is contained in:
46
js/level.js
46
js/level.js
@@ -13,10 +13,10 @@ const level = {
|
||||
// game.zoomScale = 1400 //1400
|
||||
if (game.levelsCleared === 0) {
|
||||
document.title = "n-gon";
|
||||
this.intro(); //starting level
|
||||
// this.intro(); //starting level
|
||||
// this.testingMap();
|
||||
// this.bosses();
|
||||
// this.skyscrapers();
|
||||
this.excavation();
|
||||
// this.rooftops();
|
||||
// this.warehouse();
|
||||
// this.highrise();
|
||||
@@ -374,7 +374,6 @@ const level = {
|
||||
// spawn.healer(1000, -500)
|
||||
// spawn.healer(1000, -400)
|
||||
},
|
||||
|
||||
rooftops() {
|
||||
game.zoomTransition(1700) //1400 is normal
|
||||
|
||||
@@ -568,6 +567,47 @@ const level = {
|
||||
//spawn.randomBoss(4850, -1250,0.7);
|
||||
if (game.levelsCleared > 4) spawn.bomber(2500, -2400, 100);
|
||||
},
|
||||
excavation() {
|
||||
game.zoomTransition(2200) //1400 is normal
|
||||
mech.setPosToSpawn(-50, -50); //normal spawn
|
||||
level.enter.x = mech.spawnPos.x - 50;
|
||||
level.enter.y = mech.spawnPos.y + 20;
|
||||
level.exit.x = 1500;
|
||||
level.exit.y = -1875;
|
||||
this.addZone(level.exit.x, level.exit.y, 100, 30, "nextLevel");
|
||||
// powerUps.spawnStartingPowerUps(1475, -1175);
|
||||
// spawn.debris(0, -2200, 4500, 20); //20 debris per level
|
||||
document.body.style.backgroundColor = "#dcdcde";
|
||||
|
||||
// //foreground
|
||||
// level.fill.push({
|
||||
// x: 2500,
|
||||
// y: -1100,
|
||||
// width: 450,
|
||||
// height: 250,
|
||||
// color: "rgba(0,0,0,0.1)"
|
||||
// });
|
||||
|
||||
// //background
|
||||
// level.fillBG.push({
|
||||
// x: 1300,
|
||||
// y: -1800,
|
||||
// width: 750,
|
||||
// height: 1800,
|
||||
// color: "#d4d4d7"
|
||||
// });
|
||||
|
||||
// starting room
|
||||
spawn.mapRect(-200, 0, 500, 1500);
|
||||
spawn.mapRect(-200, -300, 500, 50);
|
||||
spawn.mapRect(-200, -300, 50, 350);
|
||||
spawn.bodyRect(100, -250, 200, 240);
|
||||
|
||||
//top of building
|
||||
spawn.mapRect(600, 0, 800, 100);
|
||||
spawn.mapRect(200, 1100, 800, 400);
|
||||
spawn.mapRect(1250, 1100, 800, 400);
|
||||
},
|
||||
skyscrapers() {
|
||||
game.zoomTransition(2000) //1400 is normal
|
||||
|
||||
|
||||
@@ -597,8 +597,8 @@ const mobs = {
|
||||
pullPlayer() {
|
||||
if (this.seePlayer.yes && Matter.Vector.magnitudeSquared(Matter.Vector.sub(this.position, player.position)) < 1000000) {
|
||||
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
|
||||
player.force.x -= 1.3 * Math.cos(angle) * (mech.onGround ? 2 * player.mass * game.g : player.mass * game.g);
|
||||
player.force.y -= 0.97 * player.mass * game.g * Math.sin(angle);
|
||||
player.force.x -= game.accelScale * 1.13 * Math.cos(angle) * (mech.onGround ? 2 * player.mass * game.g : player.mass * game.g);
|
||||
player.force.y -= game.accelScale * 0.84 * player.mass * game.g * Math.sin(angle);
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(this.position.x, this.position.y);
|
||||
|
||||
133
js/player.js
133
js/player.js
@@ -1158,81 +1158,70 @@ const mech = {
|
||||
mech.drawFieldMeter()
|
||||
}
|
||||
},
|
||||
() => {
|
||||
mech.fieldMode = 7;
|
||||
game.makeTextLog("<strong style='font-size:30px;'>Thermal Radiation Field</strong><br> (right mouse or space bar) <p>field grows while active<br>damages all targets within range, <span style='color:#a00;'>including player</span><br> <span style='color:#a00;'>decreased</span> field shielding efficiency</p>", 1200);
|
||||
mech.setHoldDefaults();
|
||||
mech.fieldShieldingScale = 10;
|
||||
mech.rangeSmoothing = 0
|
||||
mech.hold = function () {
|
||||
if (mech.isHolding) {
|
||||
mech.drawHold(mech.holdingTarget);
|
||||
mech.holding();
|
||||
mech.throw();
|
||||
} else if ((keys[32] || game.mouseDownRight && mech.fieldCDcycle < game.cycle)) { //not hold but field button is pressed
|
||||
mech.grabPowerUp();
|
||||
mech.lookForPickUp(Math.max(180, mech.grabRange));
|
||||
mech.pushMobs360(140);
|
||||
// //draw grab field
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.pos.x, this.pos.y, this.grabRange - 20, this.angle - Math.PI * this.fieldArc, this.angle + Math.PI * this.fieldArc, false);
|
||||
// let EYE_RADIUS = 13;
|
||||
// ctx.lineTo(mech.pos.x + EYE_RADIUS * Math.cos(this.angle), mech.pos.y + EYE_RADIUS * 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.fieldMode = 7;
|
||||
// game.makeTextLog("<strong style='font-size:30px;'>Thermal Radiation Field</strong><br> (right mouse or space bar) <p>field grows while active<br>damages all targets within range, <span style='color:#a00;'>including player</span><br> <span style='color:#a00;'>decreased</span> field shielding efficiency</p>", 1200);
|
||||
// mech.setHoldDefaults();
|
||||
// mech.fieldShieldingScale = 10;
|
||||
// mech.rangeSmoothing = 0
|
||||
// mech.hold = function () {
|
||||
// if (mech.isHolding) {
|
||||
// mech.drawHold(mech.holdingTarget);
|
||||
// mech.holding();
|
||||
// mech.throw();
|
||||
// } else if ((keys[32] || game.mouseDownRight && mech.fieldCDcycle < game.cycle)) { //not hold but field button is pressed
|
||||
// mech.grabPowerUp();
|
||||
// mech.lookForPickUp(Math.max(180, mech.grabRange));
|
||||
// mech.pushMobs360(140);
|
||||
|
||||
if (mech.health > 0.1) {
|
||||
const DRAIN = 0.0008 //mech.fieldRegen = 0.0015
|
||||
if (mech.fieldMeter > DRAIN) {
|
||||
mech.fieldMeter -= DRAIN;
|
||||
mech.damage(0.00005 + 0.00000012 * mech.grabRange)
|
||||
//draw damage field
|
||||
mech.grabRange = mech.grabRange * 0.997 + (1350 + 150 * Math.cos(game.cycle / 30)) * 0.003
|
||||
let gradient = ctx.createRadialGradient(this.pos.x, this.pos.y, 0, this.pos.x, this.pos.y, mech.grabRange);
|
||||
gradient.addColorStop(0, 'rgba(255,255,255,0.7)');
|
||||
gradient.addColorStop(1, 'rgba(255,0,50,' + (0.6 + 0.2 * Math.random()) + ')');
|
||||
// if (mech.health > 0.1) {
|
||||
// const DRAIN = 0.0008 //mech.fieldRegen = 0.0015
|
||||
// if (mech.fieldMeter > DRAIN) {
|
||||
// mech.fieldMeter -= DRAIN;
|
||||
// mech.damage(0.00005 + 0.00000012 * mech.grabRange)
|
||||
// //draw damage field
|
||||
// mech.grabRange = mech.grabRange * 0.997 + (1350 + 150 * Math.cos(game.cycle / 30)) * 0.003
|
||||
// let gradient = ctx.createRadialGradient(this.pos.x, this.pos.y, 0, this.pos.x, this.pos.y, mech.grabRange);
|
||||
// gradient.addColorStop(0, 'rgba(255,255,255,0.7)');
|
||||
// gradient.addColorStop(1, 'rgba(255,0,50,' + (0.6 + 0.2 * Math.random()) + ')');
|
||||
|
||||
const angleOff = 2 * Math.PI * Math.random()
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.pos.x, this.pos.y, mech.grabRange + Math.sqrt(mech.grabRange) * 0.7 * (Math.random() - 0.5), angleOff, 1.8 * Math.PI + angleOff);
|
||||
ctx.fillStyle = gradient //rgba(255,0,0,0.2)
|
||||
ctx.fill();
|
||||
// const angleOff = 2 * Math.PI * Math.random()
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.pos.x, this.pos.y, mech.grabRange + Math.sqrt(mech.grabRange) * 0.7 * (Math.random() - 0.5), angleOff, 1.8 * Math.PI + angleOff);
|
||||
// ctx.fillStyle = gradient //rgba(255,0,0,0.2)
|
||||
// ctx.fill();
|
||||
|
||||
//damage and push away mobs in range
|
||||
for (let i = 0, len = mob.length; i < len; ++i) {
|
||||
if (mob[i].alive) {
|
||||
sub = Matter.Vector.sub(this.pos, mob[i].position);
|
||||
dist = Matter.Vector.magnitude(sub);
|
||||
if (dist < mech.grabRange) {
|
||||
mob[i].damage(0.01);
|
||||
mob[i].locatePlayer();
|
||||
mob[i].force = Matter.Vector.mult(Matter.Vector.normalise(sub), -0.0001 * mob[i].mass) //gently push mobs back
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mech.fieldCDcycle = game.cycle + 120;
|
||||
}
|
||||
} else {
|
||||
mech.grabRange = 180;
|
||||
mech.drawField();
|
||||
mech.grabPowerUp();
|
||||
mech.lookForPickUp();
|
||||
}
|
||||
} else if (mech.holdingTarget && mech.fireCDcycle < game.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
||||
mech.grabRange = 0
|
||||
mech.pickUp();
|
||||
} else {
|
||||
mech.grabRange = 0
|
||||
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()
|
||||
}
|
||||
},
|
||||
// //damage and push away mobs in range
|
||||
// for (let i = 0, len = mob.length; i < len; ++i) {
|
||||
// if (mob[i].alive) {
|
||||
// sub = Matter.Vector.sub(this.pos, mob[i].position);
|
||||
// dist = Matter.Vector.magnitude(sub);
|
||||
// if (dist < mech.grabRange) {
|
||||
// mob[i].damage(0.01);
|
||||
// mob[i].locatePlayer();
|
||||
// mob[i].force = Matter.Vector.mult(Matter.Vector.normalise(sub), -0.0001 * mob[i].mass) //gently push mobs back
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// mech.fieldCDcycle = game.cycle + 120;
|
||||
// }
|
||||
// } else {
|
||||
// mech.grabRange = 180;
|
||||
// mech.drawField();
|
||||
// mech.grabPowerUp();
|
||||
// mech.lookForPickUp();
|
||||
// }
|
||||
// } else if (mech.holdingTarget && mech.fireCDcycle < game.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
||||
// mech.grabRange = 0
|
||||
// mech.pickUp();
|
||||
// } else {
|
||||
// mech.grabRange = 0
|
||||
// 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) {
|
||||
// if (game.mouseInGame.x > this.pos.x) {
|
||||
|
||||
Reference in New Issue
Block a user