working on mod display
This commit is contained in:
@@ -33,6 +33,9 @@
|
|||||||
|
|
||||||
<!-- <body oncontextmenu="return false"> -->
|
<!-- <body oncontextmenu="return false"> -->
|
||||||
<div id='guns'></div>
|
<div id='guns'></div>
|
||||||
|
<div id='mods'>
|
||||||
|
Auto-Loading Heuristics
|
||||||
|
</div>
|
||||||
<div id="text-log"></div>
|
<div id="text-log"></div>
|
||||||
<div id="fade-out"></div>
|
<div id="fade-out"></div>
|
||||||
<div id="health-bg"></div>
|
<div id="health-bg"></div>
|
||||||
|
|||||||
128
js/bullets.js
128
js/bullets.js
@@ -12,6 +12,7 @@ const b = {
|
|||||||
modHealthDrain: null,
|
modHealthDrain: null,
|
||||||
modNoAmmo: null,
|
modNoAmmo: null,
|
||||||
modBulletsLastLonger: null,
|
modBulletsLastLonger: null,
|
||||||
|
// modNonEuclidean: null,
|
||||||
setModDefaults() {
|
setModDefaults() {
|
||||||
b.modFireRate = 1;
|
b.modFireRate = 1;
|
||||||
b.modExplosionRadius = 1;
|
b.modExplosionRadius = 1;
|
||||||
@@ -20,58 +21,101 @@ const b = {
|
|||||||
b.modHealthDrain = 0;
|
b.modHealthDrain = 0;
|
||||||
b.modNoAmmo = 0;
|
b.modNoAmmo = 0;
|
||||||
b.modBulletsLastLonger = 1;
|
b.modBulletsLastLonger = 1;
|
||||||
|
// b.modNonEuclidean = false;
|
||||||
},
|
},
|
||||||
mods: [
|
modText: function () {
|
||||||
() => {
|
game.makeTextLog(`<strong style='font-size:30px;'>${b.mods[b.mod].name}</strong><br> <span class='faded'>(left click)</span><p>${b.mods[b.mod].description}</p>`, 1200);
|
||||||
b.mod = 0;
|
document.getElementById("mods").innerHTML = b.mods[b.mod].name
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Auto-Loading Heuristics</strong><br> (left click)<p>your <strong>rate of fire</strong> 15% is faster</p>", 1200);
|
},
|
||||||
b.setModDefaults(); //good for guns with extra ammo: needles, M80, rapid fire, flak, super balls
|
mods: [{
|
||||||
b.modFireRate = 0.85
|
name: "Auto-Loading Heuristics",
|
||||||
//ADD: maybe add in something that changes game play
|
description: "your <strong>rate of fire</strong> 15% is faster",
|
||||||
|
effect: () => {
|
||||||
|
b.mod = 0
|
||||||
|
b.modText();
|
||||||
|
b.setModDefaults(); //good for guns with extra ammo: needles, M80, rapid fire, flak, super balls
|
||||||
|
b.modFireRate = 0.85
|
||||||
|
//ADD: maybe add in something that changes game play
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
b.mod = 1;
|
name: "Anti-Matter Cores",
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Anti-Matter Cores</strong><br> (left click)<p>your <strong>explosions</strong> are larger and do more damage</p>", 1200);
|
description: "your <strong>explosions</strong> are larger and do more damage",
|
||||||
b.setModDefaults(); //at 1.4 gives a flat 40% increase, and increased range, balanced by limited guns and self damage
|
effect: () => {
|
||||||
//testing at 1.3: grenade(+0.3), missiles, flak, M80
|
b.mod = 1
|
||||||
b.modExplosionRadius = 2; //good for guns with explosions:
|
b.modText();
|
||||||
|
b.setModDefaults(); //at 1.4 gives a flat 40% increase, and increased range, balanced by limited guns and self damage
|
||||||
|
//testing at 1.3: grenade(+0.3), missiles, flak, M80
|
||||||
|
b.modExplosionRadius = 2; //good for guns with explosions:
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
b.mod = 2;
|
name: "High Caliber Bullets",
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>High Caliber Bullets</strong><br> (left click)<p>your bullets are <strong>larger</strong> and do more physical damage</p>", 1200);
|
description: "your bullets are <strong>larger</strong> and do more physical damage",
|
||||||
b.setModDefaults(); //good for guns that do mostly projectile damage:
|
effect: () => {
|
||||||
//testing done at 1.15: one shot(+0.38), rapid fire(+0.25), spray, wave beam(+0.4 adds range and dmg), needles(+0.1)
|
b.mod = 2
|
||||||
//testing at 1.08: spray(point blank)(+0.25), one shot(+0.16), wave beam(point blank)(+0.14)
|
b.modText();
|
||||||
b.modBulletSize = 1.07;
|
b.setModDefaults(); //good for guns that do mostly projectile damage:
|
||||||
//ADD: maybe add in something that changes game play
|
//testing done at 1.15: one shot(+0.38), rapid fire(+0.25), spray, wave beam(+0.4 adds range and dmg), needles(+0.1)
|
||||||
|
//testing at 1.08: spray(point blank)(+0.25), one shot(+0.16), wave beam(point blank)(+0.14)
|
||||||
|
b.modBulletSize = 1.07;
|
||||||
|
//ADD: maybe add in something that changes game play
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
b.mod = 3;
|
name: "Energy Siphon",
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Energy Siphon</strong><br> (left click)<p>regenerate <strong>energy</strong> proportional to your damage done</p>", 1200);
|
description: "regenerate <strong>energy</strong> proportional to your damage done",
|
||||||
b.setModDefaults(); //good with laser, Nano-Scale Manufacturing, Standing Wave Harmonics, Phase Decoherence Field
|
effect: () => {
|
||||||
b.modEnergySiphon = 0.2;
|
b.mod = 3
|
||||||
|
b.modText();
|
||||||
|
b.setModDefaults(); //good with laser, Nano-Scale Manufacturing, Standing Wave Harmonics, Phase Decoherence Field
|
||||||
|
b.modEnergySiphon = 0.2;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
b.mod = 4;
|
name: "Entropy Transfer",
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Entropy Transfer</strong><br> (left click)<p><strong>heal</strong> proportional to your damage done</p>", 1200);
|
description: "<strong>heal</strong> proportional to your damage done",
|
||||||
b.setModDefaults(); //good with guns that overkill: one shot, grenade
|
effect: () => {
|
||||||
b.modHealthDrain = 0.01;
|
b.mod = 4
|
||||||
|
b.modText();
|
||||||
|
b.setModDefaults(); //good with guns that overkill: one shot, grenade
|
||||||
|
b.modHealthDrain = 0.01;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
b.mod = 5;
|
name: "Desublimated Ammunition",
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Desublimated Ammunition</strong><br> (left click)<p>1 out of 2 shots will not consume <strong>ammo</strong> when <strong>crouching</strong></p>", 1200);
|
description: "use 50% less <strong>ammo</strong> when <strong>crouching</strong>",
|
||||||
b.setModDefaults(); //good with guns that have less ammo: one shot, grenades, missiles, super balls, spray
|
effect: () => {
|
||||||
b.modNoAmmo = 1
|
b.mod = 5
|
||||||
|
b.modText();
|
||||||
|
b.setModDefaults(); //good with guns that have less ammo: one shot, grenades, missiles, super balls, spray
|
||||||
|
b.modNoAmmo = 1
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
{
|
||||||
b.mod = 6;
|
name: "Anti-Decay Coating",
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Anti-Decay Coating</strong><br> (left click)<p>your bullets <strong>last 25% longer</strong></p>", 1200);
|
description: "your bullets <strong>last 25% longer</strong>",
|
||||||
b.setModDefaults(); //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
effect: () => {
|
||||||
b.modBulletsLastLonger = 1.25
|
b.mod = 6
|
||||||
|
b.modText();
|
||||||
|
b.setModDefaults(); //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
||||||
|
b.modBulletsLastLonger = 1.25
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// name: "Non-Euclidean Geometry",
|
||||||
|
// description: "after you fall loop back to the top of the map",
|
||||||
|
// have: false,
|
||||||
|
// effect: () => {
|
||||||
|
// b.mod = 7
|
||||||
|
// b.modText();
|
||||||
|
// b.setModDefaults(); //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
|
||||||
|
// b.modNonEuclidean = true
|
||||||
|
// }
|
||||||
|
// },
|
||||||
// () => {
|
// () => {
|
||||||
// b.mod = 8;
|
// b.mod = 8;
|
||||||
// game.makeTextLog("<strong style='font-size:30px;'>Relativistic Velocity</strong><br> (left click)<p>Your bullets are effected extra by your own velocity</p>", 1200);
|
// game.makeTextLog("<strong style='font-size:30px;'>Relativistic Velocity</strong><br> <span class='faded'>(left click)</span><p>Your bullets are effected extra by your own velocity</p>", 1200);
|
||||||
// b.setModDefaults(); //good with: one shot, rapid fire, spray, super balls
|
// b.setModDefaults(); //good with: one shot, rapid fire, spray, super balls
|
||||||
// },
|
// },
|
||||||
],
|
],
|
||||||
|
|||||||
32
js/game.js
32
js/game.js
@@ -289,9 +289,9 @@ const game = {
|
|||||||
}
|
}
|
||||||
if (keys[89]) { //cycle fields with F
|
if (keys[89]) { //cycle fields with F
|
||||||
if (b.mod === b.mods.length - 1) {
|
if (b.mod === b.mods.length - 1) {
|
||||||
b.mods[0]()
|
b.mods[0].effect()
|
||||||
} else {
|
} else {
|
||||||
b.mods[b.mod + 1]()
|
b.mods[b.mod + 1].effect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keys[82]) { // teleport to mouse with R
|
if (keys[82]) { // teleport to mouse with R
|
||||||
@@ -541,7 +541,33 @@ const game = {
|
|||||||
},
|
},
|
||||||
fallChecks() {
|
fallChecks() {
|
||||||
// if 4000px deep
|
// if 4000px deep
|
||||||
if (mech.pos.y > game.fallHeight) mech.death();
|
if (mech.pos.y > game.fallHeight) {
|
||||||
|
mech.death();
|
||||||
|
// if (b.modNonEuclidean) {
|
||||||
|
// Matter.Body.setPosition(player, {
|
||||||
|
// x: player.position.x,
|
||||||
|
// y: player.position.y - 12000
|
||||||
|
// });
|
||||||
|
// Matter.Body.setVelocity(player, {
|
||||||
|
// x: player.velocity.x,
|
||||||
|
// y: player.velocity.y * 0
|
||||||
|
// });
|
||||||
|
|
||||||
|
// mech.pos.x = player.position.x;
|
||||||
|
// mech.pos.y = playerBody.position.y - mech.yOff;
|
||||||
|
|
||||||
|
// //smoothed mouse look translations
|
||||||
|
// const scale = 10;
|
||||||
|
// mech.transSmoothX = canvas.width2 - mech.pos.x - (game.mouse.x - canvas.width2) * scale;
|
||||||
|
// mech.transSmoothY = canvas.height2 - mech.pos.y - (game.mouse.y - canvas.height2) * scale;
|
||||||
|
|
||||||
|
// mech.transX = mech.transSmoothX
|
||||||
|
// mech.transY = mech.transSmoothY
|
||||||
|
|
||||||
|
// } else {
|
||||||
|
// mech.death();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
if (!(mech.cycle % 420)) {
|
if (!(mech.cycle % 420)) {
|
||||||
remove = function (who) {
|
remove = function (who) {
|
||||||
|
|||||||
10
js/index.js
10
js/index.js
@@ -2,6 +2,16 @@
|
|||||||
/* TODO: *******************************************
|
/* TODO: *******************************************
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
||||||
|
make power ups keep moving to player if the field is turned off
|
||||||
|
|
||||||
|
levels spawn by having the map aspects randomly fly into place
|
||||||
|
|
||||||
|
new map with repeating endlessness
|
||||||
|
get ideas from Manifold Garden game
|
||||||
|
if falling, get teleported above the map
|
||||||
|
this can apply to blocks mobs, and power ups as well
|
||||||
|
|
||||||
|
|
||||||
when paused show details on field, mods, guns?
|
when paused show details on field, mods, guns?
|
||||||
|
|
||||||
Find a diegetic way to see player damage (and or field meter too)
|
Find a diegetic way to see player damage (and or field meter too)
|
||||||
|
|||||||
15
js/level.js
15
js/level.js
@@ -15,12 +15,12 @@ const level = {
|
|||||||
// game.levelsCleared = 5; //for testing to simulate possible mobs spawns
|
// game.levelsCleared = 5; //for testing to simulate possible mobs spawns
|
||||||
// b.giveGuns("all", 1000)
|
// b.giveGuns("all", 1000)
|
||||||
// b.giveGuns(3) // set a starting gun for testing
|
// b.giveGuns(3) // set a starting gun for testing
|
||||||
// mech.fieldUpgrades[1](); //give a field power up for testing
|
// mech.fieldUpgrades[2](); //give a field power up for testing
|
||||||
// b.mods[6](); //give specific mod
|
// b.mods[6].effect(); //give specific mod
|
||||||
|
|
||||||
// this.intro(); //starting level
|
this.intro(); //starting level
|
||||||
// this.testingMap();
|
// this.testingMap();
|
||||||
this.bosses();
|
// this.bosses();
|
||||||
// this.aerie();
|
// this.aerie();
|
||||||
// this.rooftops();
|
// this.rooftops();
|
||||||
// this.warehouse();
|
// this.warehouse();
|
||||||
@@ -645,14 +645,17 @@ const level = {
|
|||||||
spawn.bodyRect(1750, -800, 700, 35);
|
spawn.bodyRect(1750, -800, 700, 35);
|
||||||
}
|
}
|
||||||
spawn.mapVertex(2225, -2100, "0 0 450 0 300 -2500 150 -2500")
|
spawn.mapVertex(2225, -2100, "0 0 450 0 300 -2500 150 -2500")
|
||||||
spawn.mapRect(2000, -750, 450, 300);
|
spawn.mapRect(2000, -700, 450, 300);
|
||||||
spawn.bodyRect(2360, -450, 100, 300, 0.6);
|
spawn.bodyRect(2360, -450, 100, 300, 0.6);
|
||||||
spawn.mapRect(2000, -150, 450, 350);
|
spawn.mapRect(2000, -75, 450, 275);
|
||||||
spawn.bodyRect(2450, 150, 150, 150, 0.4);
|
spawn.bodyRect(2450, 150, 150, 150, 0.4);
|
||||||
spawn.mapRect(1550, 300, 4600, 200); //ground
|
spawn.mapRect(1550, 300, 4600, 200); //ground
|
||||||
//floor below right tall tower
|
//floor below right tall tower
|
||||||
spawn.bodyRect(3000, 50, 150, 250, 0.9);
|
spawn.bodyRect(3000, 50, 150, 250, 0.9);
|
||||||
spawn.bodyRect(4500, -500, 300, 250, 0.7);
|
spawn.bodyRect(4500, -500, 300, 250, 0.7);
|
||||||
|
spawn.bodyRect(3500, -100, 100, 150, 0.7);
|
||||||
|
spawn.bodyRect(4200, -500, 110, 30, 0.7);
|
||||||
|
spawn.bodyRect(3800, -500, 150, 130, 0.7);
|
||||||
spawn.bodyRect(4000, 50, 200, 150, 0.9);
|
spawn.bodyRect(4000, 50, 200, 150, 0.9);
|
||||||
spawn.bodyRect(4500, 50, 300, 200, 0.9);
|
spawn.bodyRect(4500, 50, 300, 200, 0.9);
|
||||||
spawn.bodyRect(4200, -350, 200, 50, 0.9);
|
spawn.bodyRect(4200, -350, 200, 50, 0.9);
|
||||||
|
|||||||
95
js/player.js
95
js/player.js
@@ -161,16 +161,6 @@ const mech = {
|
|||||||
this.transX += (this.transSmoothX - this.transX) * 0.07;
|
this.transX += (this.transSmoothX - this.transX) * 0.07;
|
||||||
this.transY += (this.transSmoothY - this.transY) * 0.07;
|
this.transY += (this.transSmoothY - this.transY) * 0.07;
|
||||||
},
|
},
|
||||||
gamepadLook() {
|
|
||||||
this.angle = Math.atan2(
|
|
||||||
game.gamepad.rightAxis.y,
|
|
||||||
game.gamepad.rightAxis.x
|
|
||||||
);
|
|
||||||
// this.transX += (canvas.width2 - this.pos.x - this.transX) * 0.07 - game.gamepad.rightAxis.x * 12;
|
|
||||||
// this.transY += (canvas.height2 - this.pos.y - this.transY) * 0.03 - game.gamepad.rightAxis.y * 6;
|
|
||||||
this.transX += (canvas.width2 - this.pos.x - this.transX) * 0.02 - game.gamepad.leftAxis.x * 6;
|
|
||||||
this.transY += (canvas.height2 - this.pos.y - this.transY) * 0.02 + game.gamepad.leftAxis.y * 8;
|
|
||||||
},
|
|
||||||
doCrouch() {
|
doCrouch() {
|
||||||
if (!this.crouch) {
|
if (!this.crouch) {
|
||||||
this.crouch = true;
|
this.crouch = true;
|
||||||
@@ -857,7 +847,7 @@ const mech = {
|
|||||||
fieldUpgrades: [
|
fieldUpgrades: [
|
||||||
() => {
|
() => {
|
||||||
mech.fieldMode = 0;
|
mech.fieldMode = 0;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Field Emitter</strong><br> (right click or space bar)<p>lets you pick up and throw objects<br>shields you from damage</p>", 1200);
|
game.makeTextLog("<strong style='font-size:30px;'>Field Emitter</strong><br> <span class='faded'>(right click or space bar)</span><p>lets you <strong>pick up</strong> and throw objects<br><strong>shields</strong> you from damage</p>", 1200);
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
@@ -879,7 +869,7 @@ const mech = {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
mech.fieldMode = 1;
|
mech.fieldMode = 1;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Time Dilation Field</strong><br> (right mouse or space bar)<p> stop time while field is active<br> can fire while field is active</p>", 1200);
|
game.makeTextLog("<strong style='font-size:30px;'>Time Dilation Field</strong><br> <span class='faded'>(right click or space bar)</span><p> <strong>stop time</strong> while field is active<br> can fire while field is active</p>", 1200);
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
mech.fieldFire = true;
|
mech.fieldFire = true;
|
||||||
mech.grabRange = 130
|
mech.grabRange = 130
|
||||||
@@ -946,16 +936,17 @@ const mech = {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
mech.fieldMode = 2;
|
mech.fieldMode = 2;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Kinetic Energy Field</strong><br> (right mouse or space bar)<p> field does damage on contact<br> blocks are thrown at a higher velocity</p>", 1200);
|
game.makeTextLog("<strong style='font-size:30px;'>Electrostatic Force Field</strong><br> <span class='faded'>(right click or space bar)</span><p> field does <strong>damage</strong> on contact<br> blocks are thrown at a higher velocity<br> increased field regeneration</p>", 1200);
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
//throw quicker and harder
|
//throw quicker and harder
|
||||||
mech.fieldShieldingScale = 3;
|
mech.grabRange = 225;
|
||||||
|
mech.fieldShieldingScale = 2;
|
||||||
mech.fieldRegen *= 3;
|
mech.fieldRegen *= 3;
|
||||||
mech.throwChargeRate = 3;
|
mech.throwChargeRate = 3;
|
||||||
mech.throwChargeMax = 140;
|
mech.throwChargeMax = 140;
|
||||||
mech.fieldDamage = 3; //passive field does extra damage
|
mech.fieldDamage = 5; //passive field does extra damage
|
||||||
mech.fieldArc = 0.11
|
// mech.fieldArc = 0.11
|
||||||
mech.calculateFieldThreshold(); //run after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
// mech.calculateFieldThreshold(); //run after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
||||||
|
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
@@ -963,12 +954,28 @@ const mech = {
|
|||||||
mech.holding();
|
mech.holding();
|
||||||
mech.throw();
|
mech.throw();
|
||||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldMeter > 0.15) { //not hold but field button is pressed
|
} else if ((keys[32] || game.mouseDownRight) && mech.fieldMeter > 0.15) { //not hold but field button is pressed
|
||||||
//draw field
|
//draw electricity
|
||||||
const range = mech.grabRange - 15;
|
const Dx = Math.cos(mech.angle);
|
||||||
|
const Dy = Math.sin(mech.angle);
|
||||||
|
let x = mech.pos.x + 20 * Dx;
|
||||||
|
let y = mech.pos.y + 20 * Dy;
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - Math.PI * mech.fieldArc, mech.angle + Math.PI * mech.fieldArc, false);
|
ctx.moveTo(x, y);
|
||||||
let eye = 13;
|
for (let i = 0; i < 8; i++) {
|
||||||
ctx.lineTo(mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle));
|
x += 18 * (Dx + 2 * (Math.random() - 0.5))
|
||||||
|
y += 18 * (Dy + 2 * (Math.random() - 0.5))
|
||||||
|
ctx.lineTo(x, y);
|
||||||
|
}
|
||||||
|
ctx.lineWidth = 1 //0.5 + 2 * Math.random();
|
||||||
|
ctx.strokeStyle = `rgba(100,20,50,${0.5+0.5*Math.random()})`;
|
||||||
|
ctx.stroke();
|
||||||
|
|
||||||
|
//draw field
|
||||||
|
const range = 170;
|
||||||
|
const arc = Math.PI * 0.11
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - arc, mech.angle + arc, false);
|
||||||
|
ctx.lineTo(mech.pos.x + 13 * Math.cos(mech.angle), mech.pos.y + 13 * Math.sin(mech.angle));
|
||||||
if (mech.holdingTarget) {
|
if (mech.holdingTarget) {
|
||||||
ctx.fillStyle = "rgba(255,50,150," + (0.05 + 0.1 * Math.random()) + ")";
|
ctx.fillStyle = "rgba(255,50,150," + (0.05 + 0.1 * Math.random()) + ")";
|
||||||
} else {
|
} else {
|
||||||
@@ -977,13 +984,13 @@ const mech = {
|
|||||||
ctx.fill();
|
ctx.fill();
|
||||||
|
|
||||||
//draw random lines in field for cool effect
|
//draw random lines in field for cool effect
|
||||||
eye = 15;
|
// eye = 15;
|
||||||
ctx.beginPath();
|
// ctx.beginPath();
|
||||||
ctx.moveTo(mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle));
|
// ctx.moveTo(mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle));
|
||||||
const offAngle = mech.angle + 2 * Math.PI * mech.fieldArc * (Math.random() - 0.5);
|
// const offAngle = mech.angle + 2 * Math.PI * mech.fieldArc * (Math.random() - 0.5);
|
||||||
ctx.lineTo(mech.pos.x + range * Math.cos(offAngle), mech.pos.y + range * Math.sin(offAngle));
|
// ctx.lineTo(mech.pos.x + range * Math.cos(offAngle), mech.pos.y + range * Math.sin(offAngle));
|
||||||
ctx.strokeStyle = "rgba(100,20,50,0.2)";
|
// ctx.strokeStyle = "rgba(100,20,50,0.2)";
|
||||||
ctx.stroke();
|
// ctx.stroke();
|
||||||
|
|
||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
mech.pushMobs();
|
mech.pushMobs();
|
||||||
@@ -998,16 +1005,12 @@ const mech = {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
mech.fieldMode = 3;
|
mech.fieldMode = 3;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Negative Mass Field</strong><br> (right mouse or space bar)<p> field nullifies gravity<br> player can hold more massive objects<br>can fire while field is active</p>", 1200);
|
game.makeTextLog("<strong style='font-size:30px;'>Negative Mass Field</strong><br> <span class='faded'>(right click or space bar)</span><p> field nullifies <strong>gravity</strong><br> player can hold more massive objects<br>can fire while field is active</p>", 1200);
|
||||||
//<br> <span style='color:#a00;'>decreased</span> field shielding efficiency
|
//<br> <span style='color:#a00;'>decreased</span> field shielding efficiency
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
mech.fieldFire = true;
|
mech.fieldFire = true;
|
||||||
mech.holdingMassScale = 0.05; //can hold heavier blocks with lower cost to jumping
|
mech.holdingMassScale = 0.05; //can hold heavier blocks with lower cost to jumping
|
||||||
mech.fieldShieldingScale = 2;
|
mech.fieldShieldingScale = 2;
|
||||||
// mech.fieldArc = 1; //field covers full 360 degrees
|
|
||||||
// mech.grabRange = 150;
|
|
||||||
// mech.fieldArc = 1 //0.08;
|
|
||||||
// mech.calculateFieldThreshold(); //run after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
|
||||||
|
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
@@ -1066,12 +1069,8 @@ const mech = {
|
|||||||
ctx.arc(mech.pos.x, mech.pos.y, mech.grabRange, 0, 2 * Math.PI);
|
ctx.arc(mech.pos.x, mech.pos.y, mech.grabRange, 0, 2 * Math.PI);
|
||||||
ctx.fillStyle = "#f5f5ff";
|
ctx.fillStyle = "#f5f5ff";
|
||||||
ctx.globalCompositeOperation = "difference";
|
ctx.globalCompositeOperation = "difference";
|
||||||
// ctx.strokeStyle = "#888"
|
|
||||||
// ctx.stroke();
|
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
ctx.globalCompositeOperation = "source-over";
|
ctx.globalCompositeOperation = "source-over";
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//trigger cool down
|
//trigger cool down
|
||||||
mech.fieldCDcycle = mech.cycle + 120;
|
mech.fieldCDcycle = mech.cycle + 120;
|
||||||
@@ -1088,7 +1087,7 @@ const mech = {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
mech.fieldMode = 4;
|
mech.fieldMode = 4;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Standing Wave Harmonics</strong><br> (right mouse or space bar) <p>oscillating shields always surround player<br> <span style='color:#a00;'>decreased</span> field regeneration</p>", 1200);
|
game.makeTextLog("<strong style='font-size:30px;'>Standing Wave Harmonics</strong><br> <span class='faded'>(right click or space bar)</span> <p>oscillating shields always surround player<br> <span style='color:#a00;'>decreased</span> field regeneration</p>", 1200);
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
// mech.fieldShieldingScale = 0.5;
|
// mech.fieldShieldingScale = 0.5;
|
||||||
mech.fieldRegen *= 0.2;
|
mech.fieldRegen *= 0.2;
|
||||||
@@ -1128,15 +1127,12 @@ const mech = {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
mech.fieldMode = 5;
|
mech.fieldMode = 5;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Nano-Scale Manufacturing</strong><br> (passive effect) <p>excess field energy used to build drones<br> <span style='color:#a00;'>decreased</span> field shielding efficiency</p>", 1200);
|
game.makeTextLog("<strong style='font-size:30px;'>Nano-Scale Manufacturing</strong><br> <span class='faded'>(passive effect)</span> <p>excess field energy used to build <strong>drones</strong><br> increased field regeneration</p>", 1200);
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
mech.fieldShieldingScale = 15;
|
mech.fieldRegen *= 3;
|
||||||
mech.grabRange = 155;
|
|
||||||
mech.fieldArc = 0.1; //0.2 is normal
|
|
||||||
mech.calculateFieldThreshold(); //run after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.fieldMeter === 1) {
|
if (mech.fieldMeter === 1) {
|
||||||
mech.fieldMeter -= 0.2;
|
mech.fieldMeter -= 0.5;
|
||||||
b.guns[12].fire() //spawn drone
|
b.guns[12].fire() //spawn drone
|
||||||
}
|
}
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
@@ -1158,10 +1154,9 @@ const mech = {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
mech.fieldMode = 6;
|
mech.fieldMode = 6;
|
||||||
game.makeTextLog("<strong style='font-size:30px;'>Phase Decoherence Field</strong><br> (right mouse or space bar) <p>intangible while field is active<br>can't see or be seen outside field</p>", 1200);
|
game.makeTextLog("<strong style='font-size:30px;'>Phase Decoherence Field</strong><br> <span class='faded'>(right click or space bar)</span> <p><strong>intangible</strong> while field is active<br>can't see or be seen outside field</p>", 1200);
|
||||||
mech.setHoldDefaults();
|
mech.setHoldDefaults();
|
||||||
// mech.grabRange = 230
|
// mech.grabRange = 230
|
||||||
|
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
mech.isStealth = false //isStealth is checked in mob foundPlayer()
|
mech.isStealth = false //isStealth is checked in mob foundPlayer()
|
||||||
player.collisionFilter.mask = 0x010011 //0x010011 is normal
|
player.collisionFilter.mask = 0x010011 //0x010011 is normal
|
||||||
@@ -1170,7 +1165,7 @@ const mech = {
|
|||||||
mech.holding();
|
mech.holding();
|
||||||
mech.throw();
|
mech.throw();
|
||||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
||||||
const DRAIN = 0.0035
|
const DRAIN = 0.002
|
||||||
if (mech.fieldMeter > DRAIN) {
|
if (mech.fieldMeter > DRAIN) {
|
||||||
mech.fieldMeter -= DRAIN;
|
mech.fieldMeter -= DRAIN;
|
||||||
|
|
||||||
@@ -1187,8 +1182,6 @@ const mech = {
|
|||||||
ctx.lineWidth = 2;
|
ctx.lineWidth = 2;
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
||||||
|
|
||||||
// mech.pushMobs360(150);
|
|
||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
mech.lookForPickUp(110);
|
mech.lookForPickUp(110);
|
||||||
} else {
|
} else {
|
||||||
@@ -1204,7 +1197,7 @@ const mech = {
|
|||||||
},
|
},
|
||||||
// () => {
|
// () => {
|
||||||
// mech.fieldMode = 7;
|
// mech.fieldMode = 7;
|
||||||
// game.makeTextLog("<strong style='font-size:30px;'>Thermal Radiation Field</strong><br> (right mouse or space bar) <p>field grows while active<br>damages all targets within range, <span style='color:#a00;'>including player</span><br> <span style='color:#a00;'>decreased</span> field shielding efficiency</p>", 1200);
|
// game.makeTextLog("<strong style='font-size:30px;'>Thermal Radiation Field</strong><br> <span class='faded'>(right click or space bar)</span> <p>field grows while active<br>damages all targets within range, <span style='color:#a00;'>including player</span><br> <span style='color:#a00;'>decreased</span> field shielding efficiency</p>", 1200);
|
||||||
// mech.setHoldDefaults();
|
// mech.setHoldDefaults();
|
||||||
// mech.fieldShieldingScale = 10;
|
// mech.fieldShieldingScale = 10;
|
||||||
// mech.rangeSmoothing = 0
|
// mech.rangeSmoothing = 0
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ const powerUps = {
|
|||||||
while (mode === b.mod) {
|
while (mode === b.mod) {
|
||||||
mode = Math.floor(Math.random() * b.mods.length)
|
mode = Math.floor(Math.random() * b.mods.length)
|
||||||
}
|
}
|
||||||
b.mods[mode](); //choose random upgrade that you don't already have
|
b.mods[mode].effect(); //choose random upgrade that you don't already have
|
||||||
} else {
|
} else {
|
||||||
b.mods[this.mode](); //set a predetermined power up
|
b.mods[this.mode].effect(); //set a predetermined power up
|
||||||
}
|
}
|
||||||
if (previousMode != null) { //pop the old field out in case player wants to swap back
|
if (previousMode != null) { //pop the old field out in case player wants to swap back
|
||||||
mech.fieldCDcycle = mech.cycle + 40; //trigger fieldCD to stop power up grab automatic pick up of spawn
|
mech.fieldCDcycle = mech.cycle + 40; //trigger fieldCD to stop power up grab automatic pick up of spawn
|
||||||
@@ -109,8 +109,12 @@ const powerUps = {
|
|||||||
effect() {
|
effect() {
|
||||||
//find what guns I don't have
|
//find what guns I don't have
|
||||||
let options = [];
|
let options = [];
|
||||||
for (let i = 0; i < b.guns.length; ++i) {
|
if (b.activeGun === null) { //the first gun is good for the early game
|
||||||
if (!b.guns[i].have) options.push(i);
|
options = [0, 1, 2, 3, 4, 5, 6, 8, 9, 12]
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < b.guns.length; ++i) {
|
||||||
|
if (!b.guns[i].have) options.push(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//give player a gun they don't already have if possible
|
//give player a gun they don't already have if possible
|
||||||
if (options.length > 0) {
|
if (options.length > 0) {
|
||||||
@@ -125,9 +129,9 @@ const powerUps = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (b.inventory.length === 1) { //on the second gun pick up tell player how to change guns
|
if (b.inventory.length === 1) { //on the second gun pick up tell player how to change guns
|
||||||
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br>(left click)<br>(<strong>Q</strong>, <strong>E</strong>, and <strong>mouse wheel</strong> change weapons)<p>${b.guns[newGun].description}</p>`, 1000);
|
game.makeTextLog(`(<strong>Q</strong>, <strong>E</strong>, and <strong>mouse wheel</strong> change weapons)<br><br><strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
|
||||||
} else {
|
} else {
|
||||||
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br> (left click)<p>${b.guns[newGun].description}</p>`, 1000);
|
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
|
||||||
}
|
}
|
||||||
b.guns[newGun].have = true;
|
b.guns[newGun].have = true;
|
||||||
b.inventory.push(newGun);
|
b.inventory.push(newGun);
|
||||||
|
|||||||
21
style.css
21
style.css
@@ -132,6 +132,22 @@ summary {
|
|||||||
/*border: 2px solid rgba(0, 0, 0, 0.4);*/
|
/*border: 2px solid rgba(0, 0, 0, 0.4);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#mods {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
z-index: 2;
|
||||||
|
font-size: 21px;
|
||||||
|
color: #111;
|
||||||
|
opacity: 0.5;
|
||||||
|
background-color: rgba(255, 255, 255, 0.4);
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
|
padding: 0px 5px 0px 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
/*border: 2px solid rgba(0, 0, 0, 0.4);*/
|
||||||
|
}
|
||||||
|
|
||||||
#text-log {
|
#text-log {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20px;
|
top: 20px;
|
||||||
@@ -155,6 +171,11 @@ summary {
|
|||||||
background-color: rgba(255, 255, 255, 0.5);
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.faded {
|
||||||
|
opacity: 0.5;
|
||||||
|
font-size: 85%;
|
||||||
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 360px 10px;
|
grid-template-columns: 360px 10px;
|
||||||
|
|||||||
Reference in New Issue
Block a user