throwing blocks through map

This commit is contained in:
landgreen
2020-03-19 05:18:03 -07:00
parent 114be654cf
commit f08996b2fc
5 changed files with 22 additions and 10 deletions

View File

@@ -1687,7 +1687,7 @@ const b = {
Matter.Query.ray(map, this.position, mob[i].position).length === 0 && Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
Matter.Query.ray(body, 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 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 for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "mine") { if (b.guns[i].name === "mine") {
b.guns[i].ammo++ b.guns[i].ammo++
@@ -2629,7 +2629,7 @@ const b = {
name: "mine", //9 name: "mine", //9
description: "toss a <strong>proximity</strong> mine that <strong>sticks</strong> to walls<br>fires <strong>nails</strong> at mobs within range", description: "toss a <strong>proximity</strong> mine that <strong>sticks</strong> to walls<br>fires <strong>nails</strong> at mobs within range",
ammo: 0, ammo: 0,
ammoPack: (game.difficultyMode > 3) ? 2 : 3, ammoPack: 3,
have: false, have: false,
isStarterGun: false, isStarterGun: false,
isEasyToAim: true, isEasyToAim: true,
@@ -2695,7 +2695,7 @@ const b = {
name: "drones", //11 name: "drones", //11
description: "deploy drones that <strong>crash</strong> into mobs<br>collisions reduce their <strong>lifespan</strong> by 1 second", description: "deploy drones that <strong>crash</strong> into mobs<br>collisions reduce their <strong>lifespan</strong> by 1 second",
ammo: 0, ammo: 0,
ammoPack: 10, ammoPack: 11,
have: false, have: false,
isStarterGun: true, isStarterGun: true,
isEasyToAim: true, isEasyToAim: true,
@@ -2808,7 +2808,7 @@ const b = {
name: "rail gun", //13 name: "rail gun", //13
description: "use <strong class='color-f'>energy</strong> to launch a high-speed <strong>dense</strong> rod<br><strong>hold</strong> left mouse to charge, <strong>release</strong> to fire", description: "use <strong class='color-f'>energy</strong> to launch a high-speed <strong>dense</strong> rod<br><strong>hold</strong> left mouse to charge, <strong>release</strong> to fire",
ammo: 0, ammo: 0,
ammoPack: 2.84, ammoPack: 4,
have: false, have: false,
isStarterGun: false, isStarterGun: false,
isEasyToAim: false, isEasyToAim: false,

View File

@@ -579,6 +579,7 @@ const game = {
} }
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is mine for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is mine
if (b.guns[i].name === "mine") { if (b.guns[i].name === "mine") {
if (b.modNoAmmo) count = Math.ceil(count / 2)
b.guns[i].ammo += count b.guns[i].ammo += count
game.updateGunHUD(); game.updateGunHUD();
break; break;
@@ -698,7 +699,7 @@ const game = {
let i = who.length; let i = who.length;
while (i--) { while (i--) {
if (who[i].position.y > game.fallHeight) { if (who[i].position.y > game.fallHeight) {
if (save && game.difficultyMode < 2) { if (save && game.difficultyMode < 3) {
Matter.Body.setVelocity(who[i], { Matter.Body.setVelocity(who[i], {
x: 0, x: 0,
y: 0 y: 0

View File

@@ -29,6 +29,7 @@ const level = {
// level.warehouse(); // level.warehouse();
// level.highrise(); // level.highrise();
// level.office(); // level.office();
level.levelAnnounce();
} else { } else {
spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns
// spawn.pickList = ["focuser", "focuser"] // spawn.pickList = ["focuser", "focuser"]
@@ -85,7 +86,11 @@ const level = {
} }
}, },
levelAnnounce() { levelAnnounce() {
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() + ")"; document.title = "n-gon: L" + (level.levelsCleared) + " " + level.levels[level.onLevel] + " (" + level.difficultyText() + ")";
}
}, },
//****************************************************************************************************************** //******************************************************************************************************************
//****************************************************************************************************************** //******************************************************************************************************************

View File

@@ -841,7 +841,12 @@ const mech = {
const charge = Math.min(mech.throwCharge / 5, 1) const charge = Math.min(mech.throwCharge / 5, 1)
let speed = charge * Math.min(80, 64 / Math.pow(mech.holdingTarget.mass, 0.25)); 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; mech.throwCharge = 0;
Matter.Body.setVelocity(mech.holdingTarget, { Matter.Body.setVelocity(mech.holdingTarget, {
@@ -1102,7 +1107,6 @@ const mech = {
}, },
wakeCheck() { wakeCheck() {
if (mech.isBodiesAsleep) { if (mech.isBodiesAsleep) {
console.log('in')
mech.isBodiesAsleep = false; mech.isBodiesAsleep = false;
function wake(who) { 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.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() 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
} }
} }
}, },

View File

@@ -2,6 +2,9 @@
************** TODO - n-gon ************** ************** TODO - n-gon **************
desublimated ammo + mine reclaimation not fun game play interaction
work on burn status effect work on burn status effect
graphics don't look right graphics don't look right
how is it different from the chemical dot how is it different from the chemical dot