rail gun balance (uses energy now)

This commit is contained in:
landgreen
2020-01-19 07:46:23 -08:00
parent 57126ab42e
commit 33e2a65eb7
4 changed files with 230 additions and 244 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2,20 +2,6 @@
/* TODO: ******************************************* /* 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 add mouse constraint in testing mode
https://github.com/liabru/matter-js/blob/master/examples/events.js https://github.com/liabru/matter-js/blob/master/examples/events.js
@@ -199,7 +185,7 @@ const build = {
}, },
makeGrid() { makeGrid() {
let text = let text =
`<div style="display: flex; justify-content: space-around; align-items: center;"> `<div style="display: flex; justify-content: space-evenly; align-items: center;">
<svg class="SVG-button" onclick="build.startBuildRun()" width="105" height="55"> <svg class="SVG-button" onclick="build.startBuildRun()" width="105" height="55">
<g stroke='none' fill='#333' stroke-width="2" font-size="40px" font-family="Ariel, sans-serif"> <g stroke='none' fill='#333' stroke-width="2" font-size="40px" font-family="Ariel, sans-serif">
<text x="13" y="40">start</text> <text x="13" y="40">start</text>
@@ -256,7 +242,7 @@ const build = {
calculateCustomDifficulty() { calculateCustomDifficulty() {
let difficulty = build.list.length * game.difficultyMode let difficulty = build.list.length * game.difficultyMode
if (game.difficultyMode === 0) difficulty = build.list.length * 1 - 6 if (game.difficultyMode === 0) difficulty = build.list.length * 1 - 6
document.getElementById("starting-level").innerHTML = `starting level: <strong style="font-size:1.1em;">${difficulty}</strong>` document.getElementById("starting-level").innerHTML = `starting level: <strong style="font-size:1.05em;">${difficulty}</strong>`
}, },
startBuildRun() { startBuildRun() {
spawn.setSpawnList(); spawn.setSpawnList();
@@ -291,6 +277,7 @@ document.getElementById("build-button").addEventListener("click", () => {
document.getElementById("info").style.display = 'inline' document.getElementById("info").style.display = 'inline'
} else { } else {
build.list = [] build.list = []
build.reset()
// let text = '<p>The difficulty increases by one level for each power up you choose.<br> <button type="button" id="build-begin-button" onclick="build.startBuildRun()">Begin Run</button></p>' // let text = '<p>The difficulty increases by one level for each power up you choose.<br> <button type="button" id="build-begin-button" onclick="build.startBuildRun()">Begin Run</button></p>'
build.isShowingBuilds = true build.isShowingBuilds = true
el.style.display = "grid" el.style.display = "grid"

View File

@@ -14,12 +14,9 @@ const level = {
start() { start() {
if (level.levelsCleared === 0) { if (level.levelsCleared === 0) {
// game.difficulty = 6; //for testing to simulate possible mobs spawns // game.difficulty = 6; //for testing to simulate possible mobs spawns
// b.giveGuns(10) // b.giveGuns(13)
// mech.setField(3) // mech.setField(3)
// b.giveMod(11); // b.giveMod(6);
// b.giveMod(11);
// b.giveMod(10);
// b.giveMod(11);
level.intro(); //starting level level.intro(); //starting level
// level.testingMap(); // level.testingMap();

View File

@@ -1013,7 +1013,8 @@ const mobs = {
}, },
//replace dead mob with a regular body //replace dead mob with a regular body
replace(i) { replace(i) {
if (this.leaveBody) { //large mobs or too many bodies go intangible and fall until removed from game to help performance
if (this.leaveBody && this.mass < 10 && body.length < 50) {
const len = body.length; const len = body.length;
body[len] = Matter.Bodies.fromVertices(this.position.x, this.position.y, this.vertices); body[len] = Matter.Bodies.fromVertices(this.position.x, this.position.y, this.vertices);
Matter.Body.setVelocity(body[len], this.velocity); Matter.Body.setVelocity(body[len], this.velocity);
@@ -1021,10 +1022,9 @@ const mobs = {
body[len].collisionFilter.category = cat.body; body[len].collisionFilter.category = cat.body;
body[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet; body[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet;
//large mobs or too many bodies go intangible and fall until removed from game to help performance // if (body[len].mass > 10 || 45 + 10 * Math.random() < body.length) {
if (body[len].mass > 10 || 45 + 10 * Math.random() < body.length) { // body[len].collisionFilter.mask = cat.player | cat.bullet | cat.mob | cat.mobBullet;
body[len].collisionFilter.mask = cat.player | cat.bullet | cat.mob | cat.mobBullet; // }
}
body[len].classType = "body"; body[len].classType = "body";
World.add(engine.world, body[len]); //add to world World.add(engine.world, body[len]); //add to world
} }