added localized invisibility field

This commit is contained in:
landgreen
2019-09-19 05:57:22 -07:00
parent 2168de12d5
commit cc34e23555
4 changed files with 53 additions and 25 deletions

View File

@@ -2,17 +2,6 @@
/* TODO: ******************************************* /* TODO: *******************************************
***************************************************** *****************************************************
general gun power ups
+explosion radius
+dmg
life steal
ice bullets (reduce mob velocity on dmg)
+bullet size
get bonus ammo / reduced ammo use
+reduced cs on fire (faster fire rate)
orbiting orb fires at random targets
missiles at random targets
have mob acceleration and look frequency scale with difficulty level have mob acceleration and look frequency scale with difficulty level
this will speed up the responses of later mobs this will speed up the responses of later mobs
this should provide a feeling of difficulty without inflating the life of mobs this should provide a feeling of difficulty without inflating the life of mobs
@@ -46,15 +35,11 @@ game mechanics
low friction ground low friction ground
bouncy ground bouncy ground
give each foot a sensor to check for ground collisions
feet with not go into the ground even on slanted ground
this might be not worth it, but it might look really cool
track foot positions with velocity better as the player walks/crouch/runs track foot positions with velocity better as the player walks/crouch/runs
add bullet on damage effects add bullet on damage effects
effects could: effects could:
add to the array mod.do new mob behaviors add to the array mob.do new mob behaviors
add a damage over time add a damage over time
add a freeze add a freeze
change mob traits change mob traits
@@ -75,10 +60,6 @@ add bullet on damage effects
remove standing on player actions remove standing on player actions
replace with check if player feet are in an area. replace with check if player feet are in an area.
unused ideas
passive: walk through blocks (difficult to implement)

View File

@@ -15,7 +15,7 @@ const level = {
document.title = "n-gon"; document.title = "n-gon";
this.intro(); //starting level this.intro(); //starting level
// b.giveGuns(0) // set a starting gun for testing // b.giveGuns(0) // set a starting gun for testing
// mech.fieldUpgrades[5]() //give a field power up for testing mech.fieldUpgrades[6]() //give a field power up for testing
// game.levelsCleared = 3; //for testing to simulate possible mobs spawns // game.levelsCleared = 3; //for testing to simulate possible mobs spawns
// this.bosses(); // this.bosses();
// this.testingMap(); // this.testingMap();

View File

@@ -98,11 +98,13 @@ const mobs = {
}, },
seePlayerFreq: 20 + Math.round(Math.random() * 20), //how often NPC checks to see where player is, lower numbers have better vision seePlayerFreq: 20 + Math.round(Math.random() * 20), //how often NPC checks to see where player is, lower numbers have better vision
foundPlayer() { foundPlayer() {
if (!mech.isStealth) {
this.locatePlayer(); this.locatePlayer();
if (!this.seePlayer.yes) { if (!this.seePlayer.yes) {
this.alertNearByMobs(); this.alertNearByMobs();
this.seePlayer.yes = true; this.seePlayer.yes = true;
} }
}
}, },
lostPlayer() { lostPlayer() {
this.seePlayer.yes = false; this.seePlayer.yes = false;

View File

@@ -470,6 +470,7 @@ const mech = {
index: 0 index: 0
}, },
isHolding: false, isHolding: false,
isStealth: false,
throwCharge: 0, throwCharge: 0,
fireCDcycle: 0, fireCDcycle: 0,
fieldCDcycle: 0, fieldCDcycle: 0,
@@ -493,6 +494,7 @@ const mech = {
this.fieldMeter = 1; this.fieldMeter = 1;
this.fieldRegen = 0.0015; this.fieldRegen = 0.0015;
this.fieldCDcycle = 0; this.fieldCDcycle = 0;
this.isStealth = false;
this.holdingMassScale = 0.5; this.holdingMassScale = 0.5;
this.throwChargeRate = 2; this.throwChargeRate = 2;
this.throwChargeMax = 50; this.throwChargeMax = 50;
@@ -1035,6 +1037,49 @@ const mech = {
mech.drawFieldMeter() mech.drawFieldMeter()
} }
}, },
() => {
mech.fieldMode = 6;
game.makeTextLog("<strong style='font-size:30px;'>Metamaterial Refractive Optics</strong><br> (left mouse or space bar) <p>localized invisibility field</p>", 1000);
mech.setHoldDefaults();
mech.fieldArc = 1; //field covers full 360 degrees
mech.calculateFieldThreshold();
mech.hold = function () {
mech.isStealth = false //isStealth is checked in mob foundPlayer()
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < game.cycle) {
const DRAIN = 0.0015 //mech.fieldRegen = 0.0015
if (mech.fieldMeter > DRAIN) {
mech.fieldMeter -= DRAIN;
mech.isStealth = true //isStealth is checked in mob foundPlayer()
//draw stealth field
// ctx.fillStyle = "rgba(255,255,155,0.9)";
// ctx.fillStyle = "rgba(255,255,255,1)";
ctx.fill();
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y + 25, 110, 0, 2 * Math.PI);
ctx.globalCompositeOperation = "destination-in";
ctx.fill();
ctx.globalCompositeOperation = "source-over";
mech.grabPowerUp();
mech.lookForPickUp();
} else {
mech.fieldCDcycle = game.cycle + 120;
}
} else if (mech.holdingTarget && mech.fireCDcycle < game.cycle) { //holding, but field button is released
mech.pickUp();
} else {
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.fieldMode = 1; // mech.fieldMode = 1;
// game.makeTextLog("<h2>Time Dilation Field</h2><br><strong>active ability:</strong> hold left and right mouse to slow time<br><strong>passive bonus:</strong> +field regeneration", 1000); //<br><strong>passive bonus:</strong> can phase through blocks // game.makeTextLog("<h2>Time Dilation Field</h2><br><strong>active ability:</strong> hold left and right mouse to slow time<br><strong>passive bonus:</strong> +field regeneration", 1000); //<br><strong>passive bonus:</strong> can phase through blocks