From f08996b2fc7e4f75ccdae381dd68f42753511a90 Mon Sep 17 00:00:00 2001 From: landgreen Date: Thu, 19 Mar 2020 05:18:03 -0700 Subject: [PATCH] throwing blocks through map --- js/bullets.js | 10 +++++----- js/game.js | 3 ++- js/level.js | 7 ++++++- js/player.js | 9 ++++++--- todo.txt | 3 +++ 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/js/bullets.js b/js/bullets.js index 506c06a..efb8265 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -1687,7 +1687,7 @@ const b = { Matter.Query.ray(map, this.position, mob[i].position).length === 0 && Matter.Query.ray(body, this.position, mob[i].position).length === 0) { this.endCycle = 0 //end life if mob is near and visible - if (Math.random() < 0.8) isAmmoBack = false; //20% chance to get ammo back from undetonated mines + if (Math.random() < 0.8) isAmmoBack = false; //20% chance to get ammo back after detonation } } } @@ -1725,7 +1725,7 @@ const b = { } } } - if (isAmmoBack) { + if (isAmmoBack) { //get ammo back from b.isModMineAmmoBack for (i = 0, len = b.guns.length; i < len; i++) { //find which gun if (b.guns[i].name === "mine") { b.guns[i].ammo++ @@ -2629,7 +2629,7 @@ const b = { name: "mine", //9 description: "toss a proximity mine that sticks to walls
fires nails at mobs within range", ammo: 0, - ammoPack: (game.difficultyMode > 3) ? 2 : 3, + ammoPack: 3, have: false, isStarterGun: false, isEasyToAim: true, @@ -2695,7 +2695,7 @@ const b = { name: "drones", //11 description: "deploy drones that crash into mobs
collisions reduce their lifespan by 1 second", ammo: 0, - ammoPack: 10, + ammoPack: 11, have: false, isStarterGun: true, isEasyToAim: true, @@ -2808,7 +2808,7 @@ const b = { name: "rail gun", //13 description: "use energy to launch a high-speed dense rod
hold left mouse to charge, release to fire", ammo: 0, - ammoPack: 2.84, + ammoPack: 4, have: false, isStarterGun: false, isEasyToAim: false, diff --git a/js/game.js b/js/game.js index e0b63d9..bee633b 100644 --- a/js/game.js +++ b/js/game.js @@ -579,6 +579,7 @@ const game = { } for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is mine if (b.guns[i].name === "mine") { + if (b.modNoAmmo) count = Math.ceil(count / 2) b.guns[i].ammo += count game.updateGunHUD(); break; @@ -698,7 +699,7 @@ const game = { let i = who.length; while (i--) { if (who[i].position.y > game.fallHeight) { - if (save && game.difficultyMode < 2) { + if (save && game.difficultyMode < 3) { Matter.Body.setVelocity(who[i], { x: 0, y: 0 diff --git a/js/level.js b/js/level.js index ac4bd5f..6a952f2 100644 --- a/js/level.js +++ b/js/level.js @@ -29,6 +29,7 @@ const level = { // level.warehouse(); // level.highrise(); // level.office(); + level.levelAnnounce(); } else { spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns // spawn.pickList = ["focuser", "focuser"] @@ -85,7 +86,11 @@ const level = { } }, levelAnnounce() { - document.title = "n-gon: L" + (level.levelsCleared) + " " + level.levels[level.onLevel] + " (" + level.difficultyText() + ")"; + if (level.levelsCleared === 0) { + document.title = "n-gon: intro (" + level.difficultyText() + ")"; + } else { + document.title = "n-gon: L" + (level.levelsCleared) + " " + level.levels[level.onLevel] + " (" + level.difficultyText() + ")"; + } }, //****************************************************************************************************************** //****************************************************************************************************************** diff --git a/js/player.js b/js/player.js index 35245a7..24dae55 100644 --- a/js/player.js +++ b/js/player.js @@ -841,7 +841,12 @@ const mech = { const charge = Math.min(mech.throwCharge / 5, 1) let speed = charge * Math.min(80, 64 / Math.pow(mech.holdingTarget.mass, 0.25)); - if (Matter.Query.collides(mech.holdingTarget, map).length !== 0) speed = 0 + + if (Matter.Query.collides(mech.holdingTarget, map).length !== 0) { + speed *= 0.7 //drop speed by 30% if touching map + if (Matter.Query.ray(map, mech.holdingTarget.position, mech.pos).length !== 0) speed = 0 //drop to zero if the center of the block can't see the center of the player through the map + //|| Matter.Query.ray(body, mech.holdingTarget.position, mech.pos).length > 1 + } mech.throwCharge = 0; Matter.Body.setVelocity(mech.holdingTarget, { @@ -1102,7 +1107,6 @@ const mech = { }, wakeCheck() { if (mech.isBodiesAsleep) { - console.log('in') mech.isBodiesAsleep = false; function wake(who) { @@ -1285,7 +1289,6 @@ const mech = { 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() - if (mech.fieldMode !== 2) mech.wakeCheck(); //wake up if this is no longer the current field mode, like after a new power up } } }, diff --git a/todo.txt b/todo.txt index 0b589da..e5056b1 100644 --- a/todo.txt +++ b/todo.txt @@ -2,6 +2,9 @@ ************** TODO - n-gon ************** +desublimated ammo + mine reclaimation not fun game play interaction + + work on burn status effect graphics don't look right how is it different from the chemical dot