"use strict"; /* TODO: ******************************************* ***************************************************** show difficulty increase text in custom mode chart showing info about each mob type can use css-grid chart like custom mod add setting for random drops instead of choosing custom mode custom mode grey out mods that are bad, like selection based mods change nail-bot's movement maybe have it move in a circle around player? high friction very high acceleration towards circle location add mouse constraint in testing mode https://github.com/liabru/matter-js/blob/master/examples/events.js weekly random challenge where everyone playing each week gets the same random setup. The randomness would be determined by the date so it would sync everyone. power ups still drop, but the drops are determined by a preset list that changes each week. mod: do something at the end of each level heal to full should still be effected by the heal reduction at higher difficulty give ammo to current gun give goals/quests for each level how to track goals? take no damage don't shoot rewrite pause as a change to the main loop not important like testing loop mod: ground stomp on enterLand() mod: if you fire when out of ammo you gain 1 ammo pack at the cost of 10% max health 20% of your current health Boss mob: triangle that fires three lasers mob: has 2 or 3 shields that can regenerate over time could be just a boss gun: Spirit Bomb (singularity) use charge up like rail gun electricity graphics like plasma torch suck in nearby mobs, power ups?, blocks? sucked in stuff increase size uses energy atmosphere levels large rotating fan that the player has to move through give the user a rest, between combat low combat nonaggressive mobs one mob attacking the passive mobs more graphics Boss levels boss grows and spilt, if you don't kill it fast sensor that locks you in after you enter the boss room boss that eats other mobs and gains stats from them chance to spawn on any level (past level 5) boss that knows how to shoot (player) bullets that collide with player overwrite custom engine collision bullet mob function. add a key that player picks up and needs to set on the exit door to open it make power ups keep moving to player if the pickup field is turned off before they get picked up not sure how to do this without adding a constant check animate new level spawn by having the map aspects randomly fly into place new map with repeating endlessness get ideas from Manifold Garden game if falling, get teleported above the map I tried it, but had trouble getting the camera to adjust to the teleportation this can apply to blocks mobs, and power ups as well field power up effects field allows player to hold and throw living mobs and hack mobs give mobs more animal-like behaviors like rain world give mobs something to do when they don't see player explore map eat power ups drop power up (if killed after eating one) mobs some times aren't aggressive when low on life or after taking a large hit mobs can fight each other this might be hard to code isolated mobs try to group up. game mechanics mechanics that support the physics engine add rope/constraint get ideas from game: limbo / inside environmental hazards laser lava button / switch door fizzler moving platform map zones water low friction ground bouncy ground */ // local storage let localSettings = JSON.parse(localStorage.getItem("localSettings")); // console.log(localSettings) if (localSettings) { game.isBodyDamage = localSettings.isBodyDamage document.getElementById("body-damage").checked = localSettings.isBodyDamage game.difficultyMode = localSettings.difficultyMode document.getElementById("difficulty-select").value = localSettings.difficultyMode if (localSettings.fpsCapDefault === 'max') { game.fpsCapDefault = 999999999; } else { game.fpsCapDefault = Number(localSettings.fpsCapDefault) } document.getElementById("fps-select").value = localSettings.fpsCapDefault } else { localSettings = { isBodyDamage: true, difficultyMode: '1', fpsCapDefault: '72', }; localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage document.getElementById("body-damage").checked = localSettings.isBodyDamage document.getElementById("difficulty-select").value = localSettings.difficultyMode document.getElementById("fps-select").value = localSettings.fpsCapDefault } //collision groups // cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet | cat.mobShield const cat = { player: 0x1, map: 0x10, body: 0x100, bullet: 0x1000, powerUp: 0x10000, mob: 0x100000, mobBullet: 0x1000000, mobShield: 0x10000000, } //build build grid display const build = { isShowingBuilds: false, list: [], choosePowerUp(who, index, type) { if (type === "field" || type === "gun") { let isDeselect = false //if already click, toggle off for (let i = 0; i < build.list.length; i++) { if (build.list[i].index === index && build.list[i].type === type) { build.list.splice(i, 1); who.style.backgroundColor = "#fff" isDeselect = true break } } //check if trying to get a second field if (type === "field") { for (let i = 0; i < build.list.length; i++) { if (build.list[i].type === "field") { //if already click, toggle off build.list[i].who.style.backgroundColor = "#fff" build.list.splice(i, 1); } } } if (!isDeselect) { who.style.backgroundColor = "#919ba8" //"#868f9a" build.list[build.list.length] = { who: who, index: index, type: type, } } } else if (type === "mod") { if (who.style.backgroundColor !== "#919ba8") who.style.backgroundColor = "#919ba8" //"#868f9a" //if already clicked graphically indicate recursive clicks let count = 0 for (let i = 0; i < build.list.length; i++) { if (build.list[i].type === "mod" && build.list[i].index === index) { count++ } } if (count < b.mods[index].maxCount) { //add mod to build list build.list[build.list.length] = { who: who, index: index, type: type, } count++ //display mod count in grid box text if (count > 1) who.innerHTML = `
The difficulty increases by one level for each power up you choose.