working on cell boss

This commit is contained in:
lilgreenland
2020-01-30 16:24:09 -08:00
parent 1f17a026ac
commit e1c5f41dac
3 changed files with 225 additions and 203 deletions

View File

@@ -2,6 +2,8 @@
/* TODO: ******************************************* /* TODO: *******************************************
***************************************************** *****************************************************
boss: bacteria boss, duplicates when player is in range
mod: remove all guns from the game, but double health, shields, and damage mod: remove all guns from the game, but double health, shields, and damage
mod: like Born rule, but for guns mod: like Born rule, but for guns
@@ -9,20 +11,6 @@ mod: like Born rule, but for guns
field that pushes everything back, and can destroy smaller blocks field that pushes everything back, and can destroy smaller blocks
converts blocks into ammo power ups converts blocks into ammo power ups
give mods a requirement
check for require before choosing mods displayed in selection
require: {
type: "gun"
name: "drone"
}
drones move faster
require: {
type: "mod"
name: "high explosives"
}
immunity to explosions
remove immunity from high explosives, but buff explosion radius a bit
mod: make player invisible when... mod: make player invisible when...
use the flag from phase field use the flag from phase field

View File

@@ -13,13 +13,13 @@ const level = {
levelsCleared: 0, levelsCleared: 0,
start() { start() {
if (level.levelsCleared === 0) { if (level.levelsCleared === 0) {
// level.difficultyIncrease(7) level.difficultyIncrease(4)
// b.giveGuns("flak") b.giveGuns("minigun")
// mech.setField("phase decoherence field") // mech.setField("phase decoherence field")
// b.giveMod("ground stomp"); // b.giveMod("ground stomp");
level.intro(); //starting level // level.intro(); //starting level
// level.testingMap(); level.testingMap();
// level.bosses(); // level.bosses();
// level.satellite(); // level.satellite();
// level.skyscrapers(); // level.skyscrapers();
@@ -73,189 +73,6 @@ const level = {
}, },
//****************************************************************************************************************** //******************************************************************************************************************
//****************************************************************************************************************** //******************************************************************************************************************
satellite() {
// game.zoomScale = 4500 // remove
level.defaultZoom = 1700 // 4500 // 1400
game.zoomTransition(level.defaultZoom)
mech.setPosToSpawn(-50, -50); //normal spawn
level.enter.x = mech.spawnPos.x - 50;
level.enter.y = mech.spawnPos.y + 20;
level.exit.x = -100;
level.exit.y = -425;
level.addZone(level.exit.x, level.exit.y, 100, 30, "nextLevel");
powerUps.spawnStartingPowerUps(4450, -1400);
spawn.debris(1000, 20, 1800, 3); //16 debris per level //but less here because a few mobs die from laser
spawn.debris(4830, -1330, 850, 3); //16 debris per level
spawn.debris(3035, -3900, 1500, 3); //16 debris per level
document.body.style.backgroundColor = "#dbdcde";
//spawn start building
spawn.mapRect(-300, -800, 50, 800);
spawn.mapRect(-100, -20, 100, 30);
spawn.mapRect(-300, -10, 500, 50);
spawn.mapRect(150, -515, 50, 365);
spawn.bodyRect(170, -130, 14, 140, 1, spawn.propsFriction); //door to starting room
spawn.mapRect(-300, 0, 1000, 300); //ground
spawn.mapRect(-300, 250, 6300, 300); //deeper ground
spawn.bodyRect(2100, 50, 80, 80);
spawn.bodyRect(2000, 50, 60, 60);
// spawn.bodyRect(1650, 50, 300, 200);
spawn.bodyRect(3175, -155, 325, 325);
spawn.mapRect(1800, 175, 800, 100); //stops above body from moving to right
//exit building
spawn.mapRect(-100, -410, 100, 30);
spawn.mapRect(-300, -800, 500, 50);
spawn.mapRect(150, -800, 50, 110);
spawn.bodyRect(170, -690, 14, 175, 1, spawn.propsFriction); //door to exit room
spawn.mapRect(-300, -400, 500, 100); //far left starting ceiling
level.fill.push({
x: -250,
y: -400,
width: 1800,
height: 775,
color: "rgba(0,20,40,0.2)"
});
level.fill.push({
x: 1800,
y: -475,
width: 850,
height: 775,
color: "rgba(0,20,40,0.2)"
});
level.fillBG.push({
x: -250,
y: -750,
width: 420,
height: 450,
color: "#d4f4f4"
});
//tall platform above exit
spawn.mapRect(-500, -1900, 400, 50); //super high shade
spawn.mapRect(0, -1900, 400, 50); //super high shade
spawn.mapRect(-150, -1350, 200, 25); //super high shade
level.fillBG.push({
x: -300,
y: -1900,
width: 500,
height: 1100,
color: "#d0d4d6"
});
//tall platform
spawn.mapVertex(1125, -450, "325 0 250 80 -250 80 -325 0 -250 -80 250 -80"); //base
spawn.mapRect(150, -500, 1400, 100); //far left starting ceiling
spawn.mapRect(625, -2450, 1000, 50); //super high shade
spawn.bodyRect(1300, -3600, 150, 150); //shield from laser
level.fillBG.push({
x: 900,
y: -2450,
width: 450,
height: 2050,
color: "#d0d4d6"
});
//tall platform
spawn.mapVertex(2225, -450, "325 0 250 80 -250 80 -325 0 -250 -80 250 -80"); //base
spawn.mapRect(1725, -2800, 1000, 50); //super high shade
spawn.mapRect(1800, -500, 850, 100); //far left starting ceiling
spawn.bodyRect(2400, -2950, 150, 150); //shield from laser
level.fillBG.push({
x: 2000,
y: -2800,
width: 450,
height: 2300,
color: "#d0d4d6"
});
//tall platform
spawn.mapVertex(3350, 250, "325 0 250 80 -250 80 -325 0 -250 -80 250 -80"); //base
spawn.mapRect(2850, -3150, 1000, 50); //super high shade
spawn.bodyRect(3675, -3470, 525, 20); //plank
spawn.bodyRect(3600, -3450, 200, 300); //plank support block
level.fillBG.push({
x: 3125,
y: -3100,
width: 450,
height: 3300,
color: "#d0d4d6"
});
//far right structure
spawn.mapRect(5200, -775, 100, 920);
spawn.mapRect(5300, -1075, 350, 1220);
spawn.boost(5825, 235, 1400);
level.fillBG.push({
x: 5200,
y: 125,
width: 450,
height: 200,
color: "rgba(0,20,40,0.2)"
});
//structure bellow tall stairs
level.fill.push({
x: 4000,
y: -1200,
width: 1050,
height: 1500,
color: "rgba(0,20,40,0.13)"
});
spawn.mapRect(4000, -400, 325, 50);
spawn.mapRect(4725, -400, 325, 50);
spawn.mapRect(4000, -1300, 1050, 100);
//steep stairs
spawn.mapRect(4100, -1700, 100, 100);
spawn.mapRect(4200, -2050, 100, 450);
spawn.mapRect(4300, -2400, 100, 800);
spawn.mapRect(4400, -2750, 100, 1150);
spawn.mapRect(4500, -3100, 100, 1500);
spawn.mapRect(4600, -3450, 100, 1850);
spawn.mapRect(4100, -3450, 100, 700); //left top shelf
spawn.mapRect(4200, -3450, 100, 400); //left top shelf
spawn.mapRect(4300, -3450, 100, 100); //left top shelf
level.fillBG.push({
x: 4100,
y: -3450,
width: 500,
height: 1750,
color: "#d0d4d6"
});
level.fill.push({
x: 4100,
y: -1600,
width: 600,
height: 300,
color: "rgba(0,20,40,0.13)"
});
spawn.randomSmallMob(4400, -3500);
spawn.randomSmallMob(4800, -800);
spawn.randomSmallMob(800, 150);
spawn.randomMob(700, -600, 0.8);
spawn.randomMob(3100, -3600, 0.7);
spawn.randomMob(3300, -1000, 0.7);
spawn.randomMob(4200, -250, 0.7);
spawn.randomMob(4900, -1500, 0.6);
spawn.randomMob(1200, 100, 0.4);
spawn.randomMob(5900, -1500, 0.4);
spawn.randomMob(4700, -800, 0.4);
spawn.randomMob(1400, -400, 0.3);
spawn.randomMob(1200, 100, 0.3);
spawn.randomMob(2550, -100, 0.2);
spawn.randomMob(2000, -2800, 0.2);
spawn.randomMob(2000, -500, 0.2);
spawn.randomMob(4475, -3550, 0.1);
spawn.randomBoss(5000, -2150, 1);
spawn.randomBoss(3700, -4100, 0.3);
spawn.randomBoss(2700, -1600, 0.1);
spawn.randomBoss(1600, -100, 0);
spawn.randomBoss(5000, -3900, -0.3);
// spawn.laserBoss(2750, -2600);
if (game.difficulty > 3) spawn.laserBoss(3050, -2850);
},
testingMap() { testingMap() {
//start with all guns //start with all guns
// level.difficultyIncrease(9) //level 7 on normal, level 4 on hard, level 1.2 on why? // level.difficultyIncrease(9) //level 7 on normal, level 4 on hard, level 1.2 on why?
@@ -310,9 +127,10 @@ const level = {
// powerUps.spawn(450, -400, "mod", false); // powerUps.spawn(450, -400, "mod", false);
// spawn.bodyRect(-45, -100, 40, 50); // spawn.bodyRect(-45, -100, 40, 50);
// spawn.bomber(800, -450); // spawn.bomber(800, -450);
spawn.laserBoss(400, -750); spawn.cellBoss(400, -750);
// spawn.laser(400, -550); // spawn.laser(400, -550);
spawn.starter(1200, -1050); // spawn.starter(1200, -1050);
// spawn.nodeBoss(-600, -550, "starter"); // spawn.nodeBoss(-600, -550, "starter");
// spawn.starter(800, -150); // spawn.starter(800, -150);
// spawn.beamer(800, -150); // spawn.beamer(800, -150);
@@ -542,6 +360,189 @@ const level = {
// spawn.healer(1000, -500) // spawn.healer(1000, -500)
// spawn.healer(1000, -400) // spawn.healer(1000, -400)
}, },
satellite() {
// game.zoomScale = 4500 // remove
level.defaultZoom = 1700 // 4500 // 1400
game.zoomTransition(level.defaultZoom)
mech.setPosToSpawn(-50, -50); //normal spawn
level.enter.x = mech.spawnPos.x - 50;
level.enter.y = mech.spawnPos.y + 20;
level.exit.x = -100;
level.exit.y = -425;
level.addZone(level.exit.x, level.exit.y, 100, 30, "nextLevel");
powerUps.spawnStartingPowerUps(4450, -1400);
spawn.debris(1000, 20, 1800, 3); //16 debris per level //but less here because a few mobs die from laser
spawn.debris(4830, -1330, 850, 3); //16 debris per level
spawn.debris(3035, -3900, 1500, 3); //16 debris per level
document.body.style.backgroundColor = "#dbdcde";
//spawn start building
spawn.mapRect(-300, -800, 50, 800);
spawn.mapRect(-100, -20, 100, 30);
spawn.mapRect(-300, -10, 500, 50);
spawn.mapRect(150, -515, 50, 365);
spawn.bodyRect(170, -130, 14, 140, 1, spawn.propsFriction); //door to starting room
spawn.mapRect(-300, 0, 1000, 300); //ground
spawn.mapRect(-300, 250, 6300, 300); //deeper ground
spawn.bodyRect(2100, 50, 80, 80);
spawn.bodyRect(2000, 50, 60, 60);
// spawn.bodyRect(1650, 50, 300, 200);
spawn.bodyRect(3175, -155, 325, 325);
spawn.mapRect(1800, 175, 800, 100); //stops above body from moving to right
//exit building
spawn.mapRect(-100, -410, 100, 30);
spawn.mapRect(-300, -800, 500, 50);
spawn.mapRect(150, -800, 50, 110);
spawn.bodyRect(170, -690, 14, 175, 1, spawn.propsFriction); //door to exit room
spawn.mapRect(-300, -400, 500, 100); //far left starting ceiling
level.fill.push({
x: -250,
y: -400,
width: 1800,
height: 775,
color: "rgba(0,20,40,0.2)"
});
level.fill.push({
x: 1800,
y: -475,
width: 850,
height: 775,
color: "rgba(0,20,40,0.2)"
});
level.fillBG.push({
x: -250,
y: -750,
width: 420,
height: 450,
color: "#d4f4f4"
});
//tall platform above exit
spawn.mapRect(-500, -1900, 400, 50); //super high shade
spawn.mapRect(0, -1900, 400, 50); //super high shade
spawn.mapRect(-150, -1350, 200, 25); //super high shade
level.fillBG.push({
x: -300,
y: -1900,
width: 500,
height: 1100,
color: "#d0d4d6"
});
//tall platform
spawn.mapVertex(1125, -450, "325 0 250 80 -250 80 -325 0 -250 -80 250 -80"); //base
spawn.mapRect(150, -500, 1400, 100); //far left starting ceiling
spawn.mapRect(625, -2450, 1000, 50); //super high shade
spawn.bodyRect(1300, -3600, 150, 150); //shield from laser
level.fillBG.push({
x: 900,
y: -2450,
width: 450,
height: 2050,
color: "#d0d4d6"
});
//tall platform
spawn.mapVertex(2225, -450, "325 0 250 80 -250 80 -325 0 -250 -80 250 -80"); //base
spawn.mapRect(1725, -2800, 1000, 50); //super high shade
spawn.mapRect(1800, -500, 850, 100); //far left starting ceiling
spawn.bodyRect(2400, -2950, 150, 150); //shield from laser
level.fillBG.push({
x: 2000,
y: -2800,
width: 450,
height: 2300,
color: "#d0d4d6"
});
//tall platform
spawn.mapVertex(3350, 250, "325 0 250 80 -250 80 -325 0 -250 -80 250 -80"); //base
spawn.mapRect(2850, -3150, 1000, 50); //super high shade
spawn.bodyRect(3675, -3470, 525, 20); //plank
spawn.bodyRect(3600, -3450, 200, 300); //plank support block
level.fillBG.push({
x: 3125,
y: -3100,
width: 450,
height: 3300,
color: "#d0d4d6"
});
//far right structure
spawn.mapRect(5200, -775, 100, 920);
spawn.mapRect(5300, -1075, 350, 1220);
spawn.boost(5825, 235, 1400);
level.fillBG.push({
x: 5200,
y: 125,
width: 450,
height: 200,
color: "rgba(0,20,40,0.2)"
});
//structure bellow tall stairs
level.fill.push({
x: 4000,
y: -1200,
width: 1050,
height: 1500,
color: "rgba(0,20,40,0.13)"
});
spawn.mapRect(4000, -400, 325, 50);
spawn.mapRect(4725, -400, 325, 50);
spawn.mapRect(4000, -1300, 1050, 100);
//steep stairs
spawn.mapRect(4100, -1700, 100, 100);
spawn.mapRect(4200, -2050, 100, 450);
spawn.mapRect(4300, -2400, 100, 800);
spawn.mapRect(4400, -2750, 100, 1150);
spawn.mapRect(4500, -3100, 100, 1500);
spawn.mapRect(4600, -3450, 100, 1850);
spawn.mapRect(4100, -3450, 100, 700); //left top shelf
spawn.mapRect(4200, -3450, 100, 400); //left top shelf
spawn.mapRect(4300, -3450, 100, 100); //left top shelf
level.fillBG.push({
x: 4100,
y: -3450,
width: 500,
height: 1750,
color: "#d0d4d6"
});
level.fill.push({
x: 4100,
y: -1600,
width: 600,
height: 300,
color: "rgba(0,20,40,0.13)"
});
spawn.randomSmallMob(4400, -3500);
spawn.randomSmallMob(4800, -800);
spawn.randomSmallMob(800, 150);
spawn.randomMob(700, -600, 0.8);
spawn.randomMob(3100, -3600, 0.7);
spawn.randomMob(3300, -1000, 0.7);
spawn.randomMob(4200, -250, 0.7);
spawn.randomMob(4900, -1500, 0.6);
spawn.randomMob(1200, 100, 0.4);
spawn.randomMob(5900, -1500, 0.4);
spawn.randomMob(4700, -800, 0.4);
spawn.randomMob(1400, -400, 0.3);
spawn.randomMob(1200, 100, 0.3);
spawn.randomMob(2550, -100, 0.2);
spawn.randomMob(2000, -2800, 0.2);
spawn.randomMob(2000, -500, 0.2);
spawn.randomMob(4475, -3550, 0.1);
spawn.randomBoss(5000, -2150, 1);
spawn.randomBoss(3700, -4100, 0.3);
spawn.randomBoss(2700, -1600, 0.1);
spawn.randomBoss(1600, -100, 0);
spawn.randomBoss(5000, -3900, -0.3);
// spawn.laserBoss(2750, -2600);
if (game.difficulty > 3) spawn.laserBoss(3050, -2850);
},
rooftops() { rooftops() {
level.defaultZoom = 1700 level.defaultZoom = 1700
game.zoomTransition(level.defaultZoom) game.zoomTransition(level.defaultZoom)

View File

@@ -141,6 +141,39 @@ const spawn = {
this.attraction(); this.attraction();
}; };
}, },
cellBoss(x, y, radius = 30, dropPowerUp = true) {
//easy mob for on level 1
mobs.spawn(x, y, 8, radius, "#9ccdc6");
let me = mob[mob.length - 1];
me.accelMag = 0.0005 * game.accelScale;
me.memory = 60;
me.spawnFrequency = Math.floor(150 + Math.random() * 60)
me.seeAtDistance2 = 1400000 //1200 vision range
Matter.Body.setDensity(me, 0.0005) // normal density is 0.001 // this reduces life by half and decreases knockback
me.do = function () {
this.seePlayerByLookingAt();
this.attraction();
//look for player and spawn if player is close
const range = 500
//draw range
ctx.beginPath();
ctx.arc(this.position.x, this.position.y, range, 0, 2 * Math.PI);
ctx.fillStyle = "rgba(0,0,0,0.1)";
ctx.fill();
if (!(game.cycle % this.spawnFrequency) && this.distanceToPlayer2() < range * range) {
spawn.cellBoss(this.position.x, this.position.y, 30, false);
}
//spread out away from other cells
for (let i = 0, len = mob.length; i < len; i++) {
}
};
me.onDeath = function () {
if (dropPowerUp) powerUps.spawnBossPowerUp(this.position.x, this.position.y)
};
},
// healer(x, y, radius = 20) { // healer(x, y, radius = 20) {
// mobs.spawn(x, y, 3, radius, "rgba(50,255,200,0.4)"); // mobs.spawn(x, y, 3, radius, "rgba(50,255,200,0.4)");
// let me = mob[mob.length - 1]; // let me = mob[mob.length - 1];