throwing blocks through map
This commit is contained in:
@@ -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 <strong>proximity</strong> mine that <strong>sticks</strong> to walls<br>fires <strong>nails</strong> 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 <strong>crash</strong> into mobs<br>collisions reduce their <strong>lifespan</strong> 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 <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,
|
||||
ammoPack: 2.84,
|
||||
ammoPack: 4,
|
||||
have: false,
|
||||
isStarterGun: false,
|
||||
isEasyToAim: false,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
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() + ")";
|
||||
}
|
||||
},
|
||||
//******************************************************************************************************************
|
||||
//******************************************************************************************************************
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user