updates to community maps

This commit is contained in:
landgreen
2020-10-28 05:46:12 -07:00
parent 7b620ca1f0
commit a4a2a9bf2a
5 changed files with 560 additions and 245 deletions

View File

@@ -1563,7 +1563,7 @@ const b = {
const sub = Vector.sub(this.lockedOn.position, this.position) const sub = Vector.sub(this.lockedOn.position, this.position)
const DIST = Vector.magnitude(sub); const DIST = Vector.magnitude(sub);
const unit = Vector.normalise(sub) const unit = Vector.normalise(sub)
const DRAIN = 0.002 const DRAIN = 0.0012
if (DIST < mod.isPlasmaRange * 450 && mech.energy > DRAIN) { if (DIST < mod.isPlasmaRange * 450 && mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
if (mech.energy < 0) { if (mech.energy < 0) {

View File

@@ -2813,9 +2813,454 @@ const level = {
World.add(engine.world, cons[cons.length - 1]); World.add(engine.world, cons[cons.length - 1]);
//chance to spawn a ring of exploding mobs around this boss //chance to spawn a ring of exploding mobs around this boss
if (game.difficulty > 4) spawn.nodeBoss(2330, 1850, "spawns", 8, 20, 105); if (game.difficulty > 4) spawn.nodeBoss(2330, 1850, "spawns", 8, 20, 105);
powerUps.spawn(3010, 1630, "mod"); powerUps.chooseRandomPowerUp(3100, 1630);
powerUps.spawn(3100, 1630, "heal");
}, },
// detours() {
// level.setPosToSpawn(0, 0); //lower start
// level.exit.y = 150;
// spawn.mapRect(level.enter.x, 45, 100, 20);
// level.exit.x = 10625;
// spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20);
// level.defaultZoom = 1400;
// game.zoomTransition(level.defaultZoom)
// document.body.style.backgroundColor = "#d5d5d5";
// const BGColor = "rgba(0,0,0,0.1)";
// level.fill.push({
// x: -150,
// y: -250,
// width: 625,
// height: 325,
// color: BGColor
// });
// level.fill.push({
// x: 475,
// y: -520,
// width: 5375,
// height: 875,
// color: BGColor
// });
// level.fill.push({
// x: 5850,
// y: -1275,
// width: 2800,
// height: 2475,
// color: BGColor
// });
// level.fill.push({
// x: 8650,
// y: -500,
// width: 1600,
// height: 750,
// color: BGColor
// });
// level.fill.push({
// x: 10250,
// y: -700,
// width: 900,
// height: 950,
// color: BGColor
// });
// const rotor = level.rotor(7000, 580, -0.001);
// const buttonCouloirEnBas = level.button(5000, 255);
// const door = level.door(5825, -430, 25, 690, 700);
// const doorSortieSalle = level.door(8590, -520, 20, 800, 750)
// let doorPortal1Center
// let isAlreadySpawned = false;
// let door12isOpen = true;
// let door3isOpen = true;
// let buttonPorteSalle
// let buttonSortieSalle
// let portalEnBas
// let portalEnHaut
// function drawOnTheMapMapRect(x, y, dx, dy) {
// spawn.mapRect(x, y, dx, dy);
// len = map.length - 1
// map[len].collisionFilter.category = cat.map;
// map[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
// Matter.Body.setStatic(map[len], true); //make static
// World.add(engine.world, map[len]); //add to world
// game.draw.setPaths() //update map graphics
// }
// function drawOnTheMapBodyRect(x, y, dx, dy) {
// spawn.bodyRect(x, y, dx, dy);
// len = body.length - 1
// body[len].collisionFilter.category = cat.body;
// body[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet
// World.add(engine.world, body[len]); //add to world
// body[len].classType = "body"
// }
// function spawnCouloirEnBas() {
// isAlreadySpawned = true;
// level.fill.push({
// x: 1950,
// y: 355,
// width: 2025,
// height: 2120,
// color: BGColor
// });
// drawOnTheMapMapRect(1925, 255, 125, 2250)
// drawOnTheMapMapRect(2575, 255, 1550, 100);
// drawOnTheMapMapRect(2570, 255, 80, 400);
// drawOnTheMapMapRect(1925, 1030, 1325, 75);
// drawOnTheMapMapRect(3900, 255, 100, 2250);
// drawOnTheMapMapRect(1925, 2380, 2075, 125);
// drawOnTheMapMapRect(2600, 1680, 1400, 75);
// drawOnTheMapMapRect(1925, 1880, 225, 625);
// drawOnTheMapMapRect(2050, 1980, 200, 525);
// drawOnTheMapMapRect(2150, 2080, 200, 425);
// drawOnTheMapMapRect(2250, 2180, 200, 325);
// drawOnTheMapMapRect(2350, 2280, 200, 225);
// drawOnTheMapMapRect(3800, 1080, 200, 675);
// drawOnTheMapMapRect(3700, 1180, 200, 575);
// drawOnTheMapMapRect(3600, 1280, 200, 475);
// drawOnTheMapMapRect(3500, 1380, 200, 375);
// drawOnTheMapMapRect(3400, 1480, 200, 275);
// drawOnTheMapMapRect(3300, 1580, 200, 175);
// buttonPorteSalle = level.button(3050, 2380);
// spawn.mapVertex(3115, 2382, "100 10 -100 10 -70 -10 70 -10");
// len = map.length - 1
// map[len].collisionFilter.category = cat.map;
// map[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
// Matter.Body.setStatic(map[len], true); //make static
// World.add(engine.world, map[len]); //add to world
// game.draw.setPaths() //update map graphics
// drawOnTheMapMapRect(3775, 1680, 225, 825);
// drawOnTheMapMapRect(2250, -370, 200, 350);
// drawOnTheMapMapRect(2250, -370, 400, 50);
// drawOnTheMapMapRect(2575, -845, 75, 425);
// drawOnTheMapMapRect(1975, -520, 675, 100);
// drawOnTheMapBodyRect(2950, 1530, 150, 175);
// drawOnTheMapBodyRect(2925, 1665, 25, 25);
// drawOnTheMapBodyRect(2775, 1605, 75, 75);
// drawOnTheMapBodyRect(2050, 905, 125, 125);
// drawOnTheMapBodyRect(2650, 980, 50, 50);
// drawOnTheMapBodyRect(3375, 2280, 100, 100);
// drawOnTheMapBodyRect(2550, 2355, 75, 25);
// drawOnTheMapBodyRect(3575, 1255, 125, 25);
// drawOnTheMapBodyRect(2450, 2255, 25, 25);
// doorPortal1Center = level.door(2595, -345, 20, 280, 360)
// len = body.length - 1
// body[len].collisionFilter.category = cat.body;
// body[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet
// World.add(engine.world, body[len]); //add to world
// body[len].classType = "body"
// portalEnBas = level.portal({
// x: 3750,
// y: 2280
// }, Math.PI, {
// x: 2500,
// y: -199
// }, 0)
// spawn.randomSmallMob(3000, 830, 1);
// spawn.randomSmallMob(2800, 1930, 1);
// spawn.randomMob(3400, 1980, 0.9);
// spawn.randomMob(2750, 1330, 0.8);
// spawn.randomMob(2800, 515, 0.6);
// spawn.randomMob(2500, 1230, 0.5)
// spawn.randomMob(2450, 2030, 0.3)
// spawn.randomMob(3300, 1980, 0.3)
// levelCustom2();
// if (game.difficulty > 2) {
// if (Math.random() < 0.2) {
// // tether ball
// spawn.tetherBoss(8000, 630)
// let me = mob[mob.length - 1];
// me.onDeath = function () {
// this.removeCons(); //remove constraint
// spawnCouloirEnHaut()
// };
// cons[cons.length] = Constraint.create({
// pointA: {
// x: 8550,
// y: 680
// },
// bodyB: mob[mob.length - 1],
// stiffness: 0.00015
// });
// World.add(engine.world, cons[cons.length - 1]);
// if (game.difficulty > 4) spawn.nodeBoss(8000, 630, "spawns", 8, 20, 105);
// } else if (game.difficulty > 3) {
// spawn.randomLevelBoss(8000, 630, ["shooterBoss", "launcherBoss", "laserTargetingBoss", "spiderBoss", "laserBoss", "bomberBoss"]);
// let me = mob[mob.length - 1];
// me.onDeath = function () {
// this.removeCons(); //remove constraint
// spawnCouloirEnHaut()
// };
// }
// } else {
// spawn.randomLevelBoss(8000, 630, ["shooterBoss"]);
// let me = mob[mob.length - 1];
// me.onDeath = function () {
// spawnCouloirEnHaut()
// };
// }
// }
// function spawnCouloirEnHaut() {
// level.fill.push({
// x: 2575,
// y: -1150,
// width: 2550,
// height: 630,
// color: BGColor
// });
// level.fill.push({
// x: 1900,
// y: -2300,
// width: 1650,
// height: 1150,
// color: BGColor
// });
// level.fill.push({
// x: 3550,
// y: -1625,
// width: 1650,
// height: 475,
// color: BGColor
// });
// drawOnTheMapMapRect(3800, -270, 75, 75);
// drawOnTheMapMapRect(3900, -895, 500, 75);
// drawOnTheMapMapRect(3900, -1195, 75, 375);
// drawOnTheMapMapRect(3525, -1195, 450, 75);
// drawOnTheMapMapRect(3525, -1995, 50, 1575);
// drawOnTheMapMapRect(3325, -1995, 50, 1575);
// drawOnTheMapMapRect(3525, -1670, 1675, 75);
// drawOnTheMapMapRect(5100, -1670, 100, 1250);
// drawOnTheMapMapRect(1800, -1195, 1575, 75);
// drawOnTheMapMapRect(1800, -1520, 375, 400);
// drawOnTheMapMapRect(1800, -2370, 100, 1250);
// drawOnTheMapMapRect(2375, -1845, 375, 250);
// drawOnTheMapMapRect(2700, -1745, 650, 75);
// drawOnTheMapMapRect(1800, -2370, 1775, 100);
// drawOnTheMapMapRect(3525, -2370, 50, 775);
// drawOnTheMapMapRect(4650, -1220, 550, 75);
// drawOnTheMapBodyRect(3225, -1845, 100, 100);
// drawOnTheMapBodyRect(3575, 1255, 125, 25);
// drawOnTheMapBodyRect(2450, 2255, 25, 25);
// drawOnTheMapBodyRect(3975, -945, 175, 50);
// drawOnTheMapBodyRect(4825, -1295, 50, 75);
// drawOnTheMapBodyRect(4850, -720, 250, 200);
// drawOnTheMapBodyRect(4050, -970, 25, 25);
// drawOnTheMapBodyRect(3075, -1245, 50, 50);
// buttonSortieSalle = level.button(3000, -1745)
// spawn.mapVertex(3065, -1745, "100 10 -100 10 -70 -10 70 -10");
// len = map.length - 1
// map[len].collisionFilter.category = cat.map;
// map[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
// Matter.Body.setStatic(map[len], true); //make static
// World.add(engine.world, map[len]); //add to world
// game.draw.setPaths() //update map graphics
// portalEnHaut = level.portal({
// x: 3650,
// y: -1470
// }, Math.PI / 2, {
// x: 3250,
// y: -1473
// }, Math.PI / 2)
// spawn.randomSmallMob(2500, -2070 + Math.random(), 1);
// spawn.randomSmallMob(5000, -1370, 1);
// spawn.randomMob(5000, -645, 0.9);
// spawn.randomMob(4050, 970, 0.9);
// spawn.randomSmallMob(2800, -1620, 0.7);
// spawn.randomMob(2400, -1370, 0.5);
// spawn.randomMob(3725, -1320, 0.3);
// spawn.randomBoss(2115, -2020, 0.1)
// powerUps.spawn(5000, -1275, "heal");
// levelCustom3();
// }
// // ////////////////////////////////////////
// level.custom = () => {
// buttonCouloirEnBas.query();
// buttonCouloirEnBas.draw();
// if (buttonCouloirEnBas.isUp) {} else {
// if (isAlreadySpawned == false) {
// spawnCouloirEnBas()
// }
// }
// level.playerExitCheck();
// rotor.rotate();
// };
// level.customTopLayer = () => {
// door.draw();
// doorSortieSalle.draw();
// };
// // ////////////////////////////////////////
// function levelCustom2() {
// level.custom = () => {
// portalEnBas[2].query()
// portalEnBas[3].query()
// rotor.rotate();
// buttonPorteSalle.query();
// buttonPorteSalle.draw();
// buttonCouloirEnBas.query();
// buttonCouloirEnBas.draw();
// ////////
// if (buttonCouloirEnBas.isUp) {} else {
// if (isAlreadySpawned == false) {
// spawnCouloirEnBas()
// }
// }
// ////////////
// if (buttonPorteSalle.isUp) {
// door.isOpen = door12isOpen;
// doorPortal1Center.isOpen = door12isOpen;
// } else {
// door.isOpen = false;
// doorPortal1Center.isOpen = false;
// door12isOpen = false;
// }
// door.openClose();
// doorPortal1Center.openClose();
// level.playerExitCheck();
// };
// // //////////////////////////////////////
// level.customTopLayer = () => {
// door.draw();
// doorSortieSalle.draw();
// doorPortal1Center.draw();
// portalEnBas[0].draw();
// portalEnBas[1].draw();
// portalEnBas[2].draw();
// portalEnBas[3].draw();
// };
// }
// // //////////////////////////////////////
// function levelCustom3() {
// level.custom = () => {
// portalEnBas[2].query()
// portalEnBas[3].query()
// portalEnHaut[2].query();
// portalEnHaut[3].query();
// rotor.rotate();
// buttonPorteSalle.query();
// buttonPorteSalle.draw();
// buttonSortieSalle.query();
// buttonSortieSalle.draw();
// buttonCouloirEnBas.query();
// buttonCouloirEnBas.draw();
// ////////////
// if (buttonPorteSalle.isUp) {
// door.isOpen = door12isOpen;
// doorPortal1Center.isOpen = door12isOpen;
// } else {
// door.isOpen = false;
// doorPortal1Center.isOpen = false;
// door12isOpen = false;
// }
// door.openClose();
// doorPortal1Center.openClose();
// if (buttonSortieSalle.isUp) {
// doorSortieSalle.isOpen = door3isOpen;
// } else {
// doorSortieSalle.isOpen = false;
// door3isOpen = false;
// }
// doorSortieSalle.openClose();
// level.playerExitCheck();
// };
// // //////////////////////////////////////
// level.customTopLayer = () => {
// door.draw();
// doorPortal1Center.draw();
// doorSortieSalle.draw();
// portalEnBas[0].draw();
// portalEnBas[1].draw();
// portalEnBas[2].draw();
// portalEnBas[3].draw();
// portalEnHaut[0].draw();
// portalEnHaut[1].draw();
// portalEnHaut[2].draw();
// portalEnHaut[3].draw();
// };
// }
// //spawn box
// spawn.mapRect(-200, -295, 75, 425);
// spawn.mapRect(-200, 55, 700, 75);
// spawn.mapRect(-200, -295, 700, 75);
// spawn.bodyRect(470, -220, 25, 275); //porte spawn box
// //couloir
// spawn.mapRect(450, -520, 50, 300); //muret gauche haut
// spawn.mapRect(450, 55, 50, 300); //muret gauche bas
// spawn.mapRect(1700, -520, 50, 325); //muret 2 haut
// spawn.mapRect(1700, 55, 50, 300); //muret 2 bas
// spawn.mapRect(4375, 55, 50, 300);
// spawn.mapRect(4575, 55, 50, 300);
// spawn.bodyRect(4625, 155, 75, 100);
// spawn.bodyRect(4725, 230, 50, 25);
// if (Math.random() > 0.5) {
// powerUps.chooseRandomPowerUp(4500, 200);
// } else {
// powerUps.chooseRandomPowerUp(8350, -630);
// }
// //blocs
// spawn.bodyRect(7475, 1055, 50, 75);
// spawn.bodyRect(7775, 1105, 25, 25);
// spawn.bodyRect(6925, 1105, 125, 25);
// spawn.bodyRect(6375, 380, 50, 50);
// spawn.bodyRect(6425, -220, 125, 150);
// spawn.bodyRect(6475, -245, 125, 25);
// spawn.bodyRect(7675, -245, 100, 50);
// spawn.bodyRect(7075, -520, 50, 100);
// spawn.bodyRect(8400, -595, 100, 75);
// spawn.bodyRect(1700, 5, 50, 50);
// spawn.bodyRect(1700, -45, 50, 50);
// spawn.bodyRect(1700, -95, 50, 50);
// spawn.bodyRect(1700, -145, 50, 50);
// spawn.bodyRect(1700, -195, 50, 50);
// spawn.mapRect(450, -520, 1600, 100); //plafond 1
// spawn.mapRect(450, 255, 1600, 100); //sol 1
// spawn.mapRect(2250, -95, 1450, 75); //entresol
// spawn.mapRect(3900, -520, 2000, 100); //plafond 2
// spawn.mapRect(3900, 255, 2000, 100); //sol 2
// //grande salle
// spawn.bodyRect(5900, 830, 325, 300); //bloc en bas à gauche
// spawn.mapRect(5775, -1295, 2900, 100);
// spawn.mapRect(5775, 1130, 2900, 100); //plancher + sol grande salle
// spawn.mapRect(5925, -70, 650, 50); //plateforme middle entrée
// spawn.mapRect(7575, -520, 1100, 100); //sol salle en haut à droite
// spawn.mapRect(6800, -420, 450, 50); //petite plateforme transition vers salle en haut
// spawn.mapRect(7750, -1295, 75, 575); //mur gauche salle en haut à droite
// spawn.mapRect(6100, 430, 375, 50); //plateforme en bas, gauche rotor
// spawn.mapRect(7450, -195, 1225, 75); //longue plateforme
// //murs grande salle
// spawn.mapRect(5775, -1295, 125, 875);
// spawn.mapRect(5775, 255, 125, 975);
// spawn.mapRect(8550, -1295, 125, 875);
// spawn.mapRect(8550, 180, 125, 1050);
// //couloir 2
// spawn.mapRect(8875, -520, 1425, 325);
// spawn.mapRect(8550, -520, 1750, 100);
// spawn.mapRect(8550, 180, 2625, 100);
// spawn.mapRect(10175, -745, 125, 325);
// spawn.mapRect(10175, -745, 1000, 125);
// spawn.mapRect(11050, -745, 125, 1025);
// spawn.mapRect(8875, 80, 1425, 200);
// //MOBS
// spawn.randomSmallMob(900, -70, 1);
// spawn.randomMob(4300, 95, 1);
// spawn.randomSmallMob(6250, 630, 1);
// spawn.randomMob(6255, -835, 0.9);
// spawn.randomMob(8200, -900, 0.7);
// spawn.randomMob(5700, -270, 0.7);
// spawn.randomMob(8275, -320, 0.7);
// spawn.randomMob(2700, -270, 0.7);
// spawn.randomMob(7575, 950, 0.5);
// spawn.randomMob(7000, -695, 0.4);
// spawn.randomMob(1850, -345, 0.3);
// spawn.randomMob(3600, -270, 0.3);
// spawn.randomMob(1500, -270, 0.2);
// spawn.randomMob(1250, 55, 0.2);
// spawn.randomMob(8800, -45, 0.2);
// spawn.randomBoss(8025, -845, 0.2);
// },
detours() { detours() {
level.setPosToSpawn(0, 0); //lower start level.setPosToSpawn(0, 0); //lower start
level.exit.y = 150; level.exit.y = 150;
@@ -2861,18 +3306,13 @@ const level = {
height: 950, height: 950,
color: BGColor color: BGColor
}); });
const balance = level.spinner(5500, -412.5, 25, 660) //entrance
const rotor = level.rotor(7000, 580, -0.001); const rotor = level.rotor(7000, 580, -0.001);
const buttonCouloirEnBas = level.button(5000, 255);
const door = level.door(5825, -430, 25, 690, 700);
const doorSortieSalle = level.door(8590, -520, 20, 800, 750) const doorSortieSalle = level.door(8590, -520, 20, 800, 750)
let doorPortal1Center
let isAlreadySpawned = false;
let door12isOpen = true;
let door3isOpen = true;
let buttonPorteSalle
let buttonSortieSalle let buttonSortieSalle
let portalEnBas let portalEnBas
let portalEnHaut let portalEnHaut
let door3isOpen = false;
function drawOnTheMapMapRect(x, y, dx, dy) { function drawOnTheMapMapRect(x, y, dx, dy) {
spawn.mapRect(x, y, dx, dy); spawn.mapRect(x, y, dx, dy);
@@ -2893,113 +3333,6 @@ const level = {
body[len].classType = "body" body[len].classType = "body"
} }
function spawnCouloirEnBas() {
isAlreadySpawned = true;
level.fill.push({
x: 1950,
y: 355,
width: 2025,
height: 2120,
color: BGColor
});
drawOnTheMapMapRect(1925, 255, 125, 2250)
drawOnTheMapMapRect(2575, 255, 1550, 100);
drawOnTheMapMapRect(2570, 255, 80, 400);
drawOnTheMapMapRect(1925, 1030, 1325, 75);
drawOnTheMapMapRect(3900, 255, 100, 2250);
drawOnTheMapMapRect(1925, 2380, 2075, 125);
drawOnTheMapMapRect(2600, 1680, 1400, 75);
drawOnTheMapMapRect(1925, 1880, 225, 625);
drawOnTheMapMapRect(2050, 1980, 200, 525);
drawOnTheMapMapRect(2150, 2080, 200, 425);
drawOnTheMapMapRect(2250, 2180, 200, 325);
drawOnTheMapMapRect(2350, 2280, 200, 225);
drawOnTheMapMapRect(3800, 1080, 200, 675);
drawOnTheMapMapRect(3700, 1180, 200, 575);
drawOnTheMapMapRect(3600, 1280, 200, 475);
drawOnTheMapMapRect(3500, 1380, 200, 375);
drawOnTheMapMapRect(3400, 1480, 200, 275);
drawOnTheMapMapRect(3300, 1580, 200, 175);
buttonPorteSalle = level.button(3050, 2380);
spawn.mapVertex(3115, 2382, "100 10 -100 10 -70 -10 70 -10");
len = map.length - 1
map[len].collisionFilter.category = cat.map;
map[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
Matter.Body.setStatic(map[len], true); //make static
World.add(engine.world, map[len]); //add to world
game.draw.setPaths() //update map graphics
drawOnTheMapMapRect(3775, 1680, 225, 825);
drawOnTheMapMapRect(2250, -370, 200, 350);
drawOnTheMapMapRect(2250, -370, 400, 50);
drawOnTheMapMapRect(2575, -845, 75, 425);
drawOnTheMapMapRect(1975, -520, 675, 100);
drawOnTheMapBodyRect(2950, 1530, 150, 175);
drawOnTheMapBodyRect(2925, 1665, 25, 25);
drawOnTheMapBodyRect(2775, 1605, 75, 75);
drawOnTheMapBodyRect(2050, 905, 125, 125);
drawOnTheMapBodyRect(2650, 980, 50, 50);
drawOnTheMapBodyRect(3375, 2280, 100, 100);
drawOnTheMapBodyRect(2550, 2355, 75, 25);
drawOnTheMapBodyRect(3575, 1255, 125, 25);
drawOnTheMapBodyRect(2450, 2255, 25, 25);
doorPortal1Center = level.door(2595, -345, 20, 280, 360)
len = body.length - 1
body[len].collisionFilter.category = cat.body;
body[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet
World.add(engine.world, body[len]); //add to world
body[len].classType = "body"
portalEnBas = level.portal({
x: 3750,
y: 2280
}, Math.PI, {
x: 2500,
y: -199
}, 0)
spawn.randomSmallMob(3000, 830, 1);
spawn.randomSmallMob(2800, 1930, 1);
spawn.randomMob(3400, 1980, 0.9);
spawn.randomMob(2750, 1330, 0.8);
spawn.randomMob(2800, 515, 0.6);
spawn.randomMob(2500, 1230, 0.5)
spawn.randomMob(2450, 2030, 0.3)
spawn.randomMob(3300, 1980, 0.3)
levelCustom2();
if (game.difficulty > 2) {
if (Math.random() < 0.2) {
// tether ball
spawn.tetherBoss(8000, 630)
let me = mob[mob.length - 1];
me.onDeath = function () {
this.removeCons(); //remove constraint
spawnCouloirEnHaut()
};
cons[cons.length] = Constraint.create({
pointA: {
x: 8550,
y: 680
},
bodyB: mob[mob.length - 1],
stiffness: 0.00015
});
World.add(engine.world, cons[cons.length - 1]);
if (game.difficulty > 4) spawn.nodeBoss(8000, 630, "spawns", 8, 20, 105);
} else if (game.difficulty > 3) {
spawn.randomLevelBoss(8000, 630, ["shooterBoss", "launcherBoss", "laserTargetingBoss", "spiderBoss", "laserBoss", "bomberBoss"]);
let me = mob[mob.length - 1];
me.onDeath = function () {
this.removeCons(); //remove constraint
spawnCouloirEnHaut()
};
}
} else {
spawn.randomLevelBoss(8000, 630, ["shooterBoss"]);
let me = mob[mob.length - 1];
me.onDeath = function () {
spawnCouloirEnHaut()
};
}
}
function spawnCouloirEnHaut() { function spawnCouloirEnHaut() {
level.fill.push({ level.fill.push({
x: 2575, x: 2575,
@@ -3073,91 +3406,31 @@ const level = {
spawn.randomBoss(2115, -2020, 0.1) spawn.randomBoss(2115, -2020, 0.1)
powerUps.spawn(5000, -1275, "heal"); powerUps.spawn(5000, -1275, "heal");
levelCustom3(); levelCustom2();
} }
//////////////////////////////////////////
// ////////////////////////////////////////
level.custom = () => { level.custom = () => {
buttonCouloirEnBas.query();
buttonCouloirEnBas.draw();
if (buttonCouloirEnBas.isUp) {} else {
if (isAlreadySpawned == false) {
spawnCouloirEnBas()
}
}
level.playerExitCheck(); level.playerExitCheck();
rotor.rotate(); rotor.rotate();
// rotor2.rotate()
}; };
level.customTopLayer = () => { level.customTopLayer = () => {
door.draw();
doorSortieSalle.draw(); doorSortieSalle.draw();
ctx.fillStyle = "#233"
ctx.beginPath();
ctx.arc(balance.pointA.x, balance.pointA.y, 9, 0, 2 * Math.PI);
ctx.fill();
}; };
// //////////////////////////////////////// ////////////////////////////////////////
function levelCustom2() { function levelCustom2() {
level.custom = () => { level.custom = () => {
portalEnBas[2].query()
portalEnBas[3].query()
rotor.rotate();
buttonPorteSalle.query();
buttonPorteSalle.draw();
buttonCouloirEnBas.query();
buttonCouloirEnBas.draw();
////////
if (buttonCouloirEnBas.isUp) {} else {
if (isAlreadySpawned == false) {
spawnCouloirEnBas()
}
}
////////////
if (buttonPorteSalle.isUp) {
door.isOpen = door12isOpen;
doorPortal1Center.isOpen = door12isOpen;
} else {
door.isOpen = false;
doorPortal1Center.isOpen = false;
door12isOpen = false;
}
door.openClose();
doorPortal1Center.openClose();
level.playerExitCheck();
};
// //////////////////////////////////////
level.customTopLayer = () => {
door.draw();
doorSortieSalle.draw();
doorPortal1Center.draw();
portalEnBas[0].draw();
portalEnBas[1].draw();
portalEnBas[2].draw();
portalEnBas[3].draw();
};
}
// //////////////////////////////////////
function levelCustom3() {
level.custom = () => {
portalEnBas[2].query()
portalEnBas[3].query()
portalEnHaut[2].query(); portalEnHaut[2].query();
portalEnHaut[3].query(); portalEnHaut[3].query();
rotor.rotate(); rotor.rotate();
buttonPorteSalle.query(); // rotor2.rotate
buttonPorteSalle.draw();
buttonSortieSalle.query(); buttonSortieSalle.query();
buttonSortieSalle.draw(); buttonSortieSalle.draw();
buttonCouloirEnBas.query();
buttonCouloirEnBas.draw();
//////////// ////////////
if (buttonPorteSalle.isUp) {
door.isOpen = door12isOpen;
doorPortal1Center.isOpen = door12isOpen;
} else {
door.isOpen = false;
doorPortal1Center.isOpen = false;
door12isOpen = false;
}
door.openClose();
doorPortal1Center.openClose();
if (buttonSortieSalle.isUp) { if (buttonSortieSalle.isUp) {
doorSortieSalle.isOpen = door3isOpen; doorSortieSalle.isOpen = door3isOpen;
} else { } else {
@@ -3169,17 +3442,15 @@ const level = {
}; };
// ////////////////////////////////////// // //////////////////////////////////////
level.customTopLayer = () => { level.customTopLayer = () => {
door.draw();
doorPortal1Center.draw();
doorSortieSalle.draw(); doorSortieSalle.draw();
portalEnBas[0].draw();
portalEnBas[1].draw();
portalEnBas[2].draw();
portalEnBas[3].draw();
portalEnHaut[0].draw(); portalEnHaut[0].draw();
portalEnHaut[1].draw(); portalEnHaut[1].draw();
portalEnHaut[2].draw(); portalEnHaut[2].draw();
portalEnHaut[3].draw(); portalEnHaut[3].draw();
ctx.fillStyle = "#233"
ctx.beginPath();
ctx.arc(balance.pointA.x, balance.pointA.y, 9, 0, 2 * Math.PI);
ctx.fill();
}; };
} }
//spawn box //spawn box
@@ -3261,6 +3532,41 @@ const level = {
spawn.randomMob(1250, 55, 0.2); spawn.randomMob(1250, 55, 0.2);
spawn.randomMob(8800, -45, 0.2); spawn.randomMob(8800, -45, 0.2);
spawn.randomBoss(8025, -845, 0.2); spawn.randomBoss(8025, -845, 0.2);
if (game.difficulty > 2) {
if (Math.random() < 0.2) {
// tether ball
spawn.tetherBoss(8000, 630)
let me = mob[mob.length - 1];
me.onDeath = function () {
this.removeCons(); //remove constraint
spawnCouloirEnHaut()
};
cons[cons.length] = Constraint.create({
pointA: {
x: 8550,
y: 680
},
bodyB: mob[mob.length - 1],
stiffness: 0.00015
});
World.add(engine.world, cons[cons.length - 1]);
if (game.difficulty > 4) spawn.nodeBoss(8000, 630, "spawns", 8, 20, 105);
} else if (game.difficulty > 3) {
spawn.randomLevelBoss(8000, 630, ["shooterBoss", "launcherBoss", "laserTargetingBoss", "spiderBoss", "laserBoss", "bomberBoss"]);
let me = mob[mob.length - 1];
me.onDeath = function () {
this.removeCons(); //remove constraint
spawnCouloirEnHaut()
};
}
} else {
spawn.randomLevelBoss(8000, 630, ["shooterBoss"]);
let me = mob[mob.length - 1];
me.onDeath = function () {
spawnCouloirEnHaut()
};
}
}, },
house() { house() {
const rotor = level.rotor(4315, -315, -0.0002, 120, 20, 200); const rotor = level.rotor(4315, -315, -0.0002, 120, 20, 200);
@@ -3506,7 +3812,7 @@ const level = {
y: -400, y: -400,
width: 275, width: 275,
height: 175, height: 175,
color: "rgba(64,64,64,0.96)" color: "rgba(64,64,64,0.97)"
}) })
@@ -3527,27 +3833,27 @@ const level = {
} }
//chairs //chairs
const part1 = Matter.Bodies.rectangle(4525, -455, 25, 200, { const part1 = Matter.Bodies.rectangle(4525, -255, 25, 200, {
density: 0.0005, density: 0.0005,
isNotHoldable: true, isNotHoldable: true,
}); });
const part2 = Matter.Bodies.rectangle(4562, -435, 100, 25, { const part2 = Matter.Bodies.rectangle(4562, -235, 100, 25, {
density: 0.0005, density: 0.0005,
isNotHoldable: true, isNotHoldable: true,
}); });
const part3 = Matter.Bodies.rectangle(4600, -402, 25, 91.5, { const part3 = Matter.Bodies.rectangle(4600, -202, 25, 91.5, {
density: 0.0005, density: 0.0005,
isNotHoldable: true, isNotHoldable: true,
}); });
const part4 = Matter.Bodies.rectangle(5100, -455, 25, 200, { const part4 = Matter.Bodies.rectangle(5100, -255, 25, 200, {
density: 0.0005, density: 0.0005,
isNotHoldable: true, isNotHoldable: true,
}); });
const part5 = Matter.Bodies.rectangle(5063, -435, 100, 25, { const part5 = Matter.Bodies.rectangle(5063, -235, 100, 25, {
density: 0.0005, density: 0.0005,
isNotHoldable: true, isNotHoldable: true,
}); });
const part6 = Matter.Bodies.rectangle(5025, -402, 25, 91.5, { const part6 = Matter.Bodies.rectangle(5025, -202, 25, 91.5, {
density: 0.0005, density: 0.0005,
isNotHoldable: true, isNotHoldable: true,
}); });
@@ -3575,34 +3881,34 @@ const level = {
chair2.collisionFilter.category = cat.body; chair2.collisionFilter.category = cat.body;
chair2.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map chair2.collisionFilter.mask = cat.body | cat.player | cat.bullet | cat.mob | cat.mobBullet | cat.map
}, 1000); }, 1000);
var head = Matter.Bodies.rectangle(300, -400 - 60, 34, 40, { var head = Matter.Bodies.rectangle(300, -200 - 60, 34, 40, {
isNotHoldable: true, isNotHoldable: true,
}); });
var chest = Matter.Bodies.rectangle(300, -400, 55, 80, { var chest = Matter.Bodies.rectangle(300, -200, 55, 80, {
isNotHoldable: true, isNotHoldable: true,
}); });
var rightUpperArm = Matter.Bodies.rectangle(300 + 39, -400 - 15, 20, 40, { var rightUpperArm = Matter.Bodies.rectangle(300 + 39, -200 - 15, 20, 40, {
isNotHoldable: true, isNotHoldable: true,
}); });
var rightLowerArm = Matter.Bodies.rectangle(300 + 39, -400 + 25, 20, 60, { var rightLowerArm = Matter.Bodies.rectangle(300 + 39, -200 + 25, 20, 60, {
isNotHoldable: true, isNotHoldable: true,
}); });
var leftUpperArm = Matter.Bodies.rectangle(300 - 39, -400 - 15, 20, 40, { var leftUpperArm = Matter.Bodies.rectangle(300 - 39, -200 - 15, 20, 40, {
isNotHoldable: true, isNotHoldable: true,
}); });
var leftLowerArm = Matter.Bodies.rectangle(300 - 39, -400 + 25, 20, 60, { var leftLowerArm = Matter.Bodies.rectangle(300 - 39, -200 + 25, 20, 60, {
isNotHoldable: true, isNotHoldable: true,
}); });
var leftUpperLeg = Matter.Bodies.rectangle(300 - 20, -400 + 57, 20, 40, { var leftUpperLeg = Matter.Bodies.rectangle(300 - 20, -200 + 57, 20, 40, {
isNotHoldable: true, isNotHoldable: true,
}); });
var leftLowerLeg = Matter.Bodies.rectangle(300 - 20, -400 + 97, 20, 60, { var leftLowerLeg = Matter.Bodies.rectangle(300 - 20, -200 + 97, 20, 60, {
isNotHoldable: true, isNotHoldable: true,
}); });
var rightUpperLeg = Matter.Bodies.rectangle(300 + 20, -400 + 57, 20, 40, { var rightUpperLeg = Matter.Bodies.rectangle(300 + 20, -200 + 57, 20, 40, {
isNotHoldable: true, isNotHoldable: true,
}); });
var rightLowerLeg = Matter.Bodies.rectangle(300 + 20, -400 + 97, 20, 60, { var rightLowerLeg = Matter.Bodies.rectangle(300 + 20, -200 + 97, 20, 60, {
isNotHoldable: true, isNotHoldable: true,
}); });
@@ -3660,13 +3966,22 @@ const level = {
//cuisine //cuisine
spawn.mapRect(4025, -850, 50, 175); //porte cuisine spawn.mapRect(4025, -850, 50, 175); //porte cuisine
spawn.mapRect(4025, -375, 50, 125); //porte cuisine spawn.mapRect(4025, -375, 50, 125); //porte cuisine
// blocs
spawn.bodyRect(4025, -425, 50, 50); map[map.length] = Bodies.polygon(4050, -675, 0, 15); //circle above door
spawn.bodyRect(4025, -475, 50, 50); spawn.bodyRect(4040, -650, 20, 260, 1, spawn.propsDoor); // door
spawn.bodyRect(4025, -525, 50, 50); body[body.length - 1].isNotHoldable = true;
spawn.bodyRect(4025, -575, 50, 50); //makes door swing
spawn.bodyRect(4025, -625, 50, 50); consBB[consBB.length] = Constraint.create({
spawn.bodyRect(4025, -675, 50, 50); bodyA: body[body.length - 1],
pointA: {
x: 0,
y: -130
},
bodyB: map[map.length - 1],
stiffness: 1
});
World.add(engine.world, consBB[consBB.length - 1]);
//table + chaises //table + chaises
spawn.mapRect(4025, -850, 50, 175); spawn.mapRect(4025, -850, 50, 175);
spawn.mapRect(4650, -375, 325, 25); spawn.mapRect(4650, -375, 325, 25);
@@ -3746,6 +4061,7 @@ const level = {
spawn.mapRect(4225, -1750, 250, 50); spawn.mapRect(4225, -1750, 250, 50);
level.chain(2495, -2130, 0, true, 10); level.chain(2495, -2130, 0, true, 10);
spawn.bodyRect(2950, -375, 120, 120) //bloc hidden zone
spawn.bodyRect(2350, -1850, 75, 75); spawn.bodyRect(2350, -1850, 75, 75);
spawn.bodyRect(4275, -1900, 75, 100); spawn.bodyRect(4275, -1900, 75, 100);
spawn.bodyRect(4825, -1650, 325, 200); spawn.bodyRect(4825, -1650, 325, 200);
@@ -3781,9 +4097,9 @@ const level = {
spawn.debris(1200, -350, 1475, 4); //16 debris per level spawn.debris(1200, -350, 1475, 4); //16 debris per level
spawn.debris(1250, -1550, 3565, 9); //16 debris per level spawn.debris(1250, -1550, 3565, 9); //16 debris per level
powerUps.chooseRandomPowerUp(2860, -270);
// Mobs // Mobs
spawn.mobBloc(3013, -315, 87.68, "rgba(0,0,0,0");
spawn.randomSmallMob(1385, -600, 1); spawn.randomSmallMob(1385, -600, 1);
spawn.randomSmallMob(5000, -680, 1); spawn.randomSmallMob(5000, -680, 1);
spawn.randomSmallMob(4750, -925, 1); spawn.randomSmallMob(4750, -925, 1);

View File

@@ -1575,7 +1575,7 @@ const mech = {
} else if (input.field && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed } else if (input.field && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(); mech.lookForPickUp();
const DRAIN = 0.002 const DRAIN = 0.0012
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
if (mech.energy < 0) { if (mech.energy < 0) {

View File

@@ -2188,30 +2188,30 @@ const spawn = {
}, },
//fan made mobs ***************************************************************************************** //fan made mobs *****************************************************************************************
//******************************************************************************************************* //*******************************************************************************************************
mobBloc(x, y, radius, color) { // mobBloc(x, y, radius, color) {
mobs.spawn(x, y, 4, radius, color); // mobs.spawn(x, y, 4, radius, color);
let me = mob[mob.length - 1]; // let me = mob[mob.length - 1];
me.stroke = "transparent"; // me.stroke = "transparent";
me.startingPosition = { // me.startingPosition = {
x: x, // x: x,
y: y // y: y
} // }
Matter.Body.setDensity(me, 0.002); // Matter.Body.setDensity(me, 0.002);
me.leaveBody = false; // me.leaveBody = false;
me.isStatic = true; // me.isStatic = true;
me.showHealthBar = false; // me.showHealthBar = false;
me.collisionFilter.category = cat.map; // me.collisionFilter.category = cat.map;
me.collisionFilter.mask = cat.powerUp | cat.map | cat.player | cat.bullet | cat.body // me.collisionFilter.mask = cat.powerUp | cat.map | cat.player | cat.bullet | cat.body
me.rotateVelocity = 0 // me.rotateVelocity = 0
me.do = function () { // me.do = function () {
Matter.Body.setVelocity(this, { // Matter.Body.setVelocity(this, {
x: 0, // x: 0,
y: 0 // y: 0
}); // });
Matter.Body.setPosition(this, this.startingPosition); // Matter.Body.setPosition(this, this.startingPosition);
this.checkStatus(); // this.checkStatus();
}; // };
}, // },
//complex constrained mob templates********************************************************************** //complex constrained mob templates**********************************************************************
//******************************************************************************************************* //*******************************************************************************************************
allowShields: true, allowShields: true,

View File

@@ -1,11 +1,10 @@
neutron bomb does 60% more damage neutron bomb does 60% more damage
powerUpBoss has a shorter vision range, and accelerates slower powerUpBoss has a shorter vision range, and accelerates slower
custom mode has the option to disable mod, guns, and fields custom mode has the option to disable mod, guns, and fields
several changes to community maps (by Francois 👑)
************** TODO - n-gon ************** ************** TODO - n-gon **************
add setting to disable power ups spawns for custom mode
mod - explosions apply radiation damage over time mod - explosions apply radiation damage over time
or spawn a neutron bomb with a short timer or spawn a neutron bomb with a short timer