various adjustments
This commit is contained in:
@@ -40,7 +40,7 @@ const b = {
|
||||
},
|
||||
{
|
||||
name: "Anti-Matter Cores",
|
||||
description: "your <strong>explosions</strong> are larger and more dangerous",
|
||||
description: "The radius of your <strong>explosions</strong> is doubled",
|
||||
effect: () => {
|
||||
b.mod = 1
|
||||
b.modText();
|
||||
@@ -50,7 +50,7 @@ const b = {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "High Caliber Bullets",
|
||||
name: "Depleted Uranium Rounds",
|
||||
description: "your bullets are <strong>larger</strong> and do more physical damage",
|
||||
effect: () => {
|
||||
b.mod = 2
|
||||
@@ -69,7 +69,7 @@ const b = {
|
||||
b.mod = 3
|
||||
b.modText();
|
||||
b.setModDefaults(); //good with laser, and all fields
|
||||
b.modEnergySiphon = 0.2;
|
||||
b.modEnergySiphon = 0.25;
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -94,12 +94,12 @@ const b = {
|
||||
},
|
||||
{
|
||||
name: "Decay Resistant Topology",
|
||||
description: "your bullets <strong>last 30% longer</strong>",
|
||||
description: "your bullets <strong>last 40% longer</strong>",
|
||||
effect: () => {
|
||||
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.30
|
||||
b.modBulletsLastLonger = 1.40
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
/* TODO: *******************************************
|
||||
*****************************************************
|
||||
|
||||
make player legs just slide if the player is above the normal speed
|
||||
like when you fire the one shot
|
||||
|
||||
make power ups keep moving to player if the field is turned off
|
||||
|
||||
levels spawn by having the map aspects randomly fly into place
|
||||
@@ -12,11 +9,9 @@ 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
|
||||
I tried it, but had trouble getting the camera to adjust
|
||||
this can apply to blocks mobs, and power ups as well
|
||||
|
||||
|
||||
when paused show details on field, mods, guns?
|
||||
|
||||
Find a diegetic way to see player damage (and or field meter too)
|
||||
a health meter, like the field meter above player? (doesn't work with the field meter)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ const level = {
|
||||
onLevel: 0,
|
||||
start() {
|
||||
if (game.levelsCleared === 0) {
|
||||
// game.levelsCleared = 6; //for testing to simulate possible mobs spawns
|
||||
// game.levelsCleared = 16; //for testing to simulate possible mobs spawns
|
||||
// b.giveGuns("all", 1000)
|
||||
// b.giveGuns(3) // set a starting gun for testing
|
||||
// mech.fieldUpgrades[2].effect(); //give a field power up for testing
|
||||
|
||||
70
js/player.js
70
js/player.js
@@ -359,12 +359,11 @@ const mech = {
|
||||
alive: true,
|
||||
death() {
|
||||
if (b.modIsImmortal) { //if player has the immortality buff, spawn on the same level with randomized stats
|
||||
//remove mod
|
||||
//remove mods
|
||||
b.mod = null
|
||||
b.setModDefaults();
|
||||
b.modText();
|
||||
|
||||
|
||||
function randomizeField() {
|
||||
if (game.levelsCleared > 5) {
|
||||
mech.fieldUpgrades[Math.floor(Math.random() * (mech.fieldUpgrades.length))].effect();
|
||||
@@ -383,17 +382,23 @@ const mech = {
|
||||
b.inventory = []; //removes guns and ammo
|
||||
for (let i = 0, len = b.guns.length; i < len; ++i) {
|
||||
b.guns[i].have = false;
|
||||
if (b.guns[i].ammo != Infinity) b.guns[i].ammo = 0;
|
||||
if (b.guns[i].ammo !== Infinity) b.guns[i].ammo = 0;
|
||||
}
|
||||
if (game.levelsCleared > 0) powerUps.gun.effect();
|
||||
if (game.levelsCleared > 1) powerUps.gun.effect();
|
||||
if (game.levelsCleared > 3) powerUps.gun.effect();
|
||||
if (game.levelsCleared > 6) powerUps.gun.effect();
|
||||
game.makeGunHUD();
|
||||
//randomize ammo
|
||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||
if (b.guns[b.inventory[i]].ammo !== Infinity) {
|
||||
b.guns[b.inventory[i]].ammo = Math.max(0, Math.floor(2.2 * b.guns[b.inventory[i]].ammo * (Math.random() - 0.15)))
|
||||
}
|
||||
}
|
||||
game.makeGunHUD(); //update gun HUD
|
||||
}
|
||||
|
||||
game.wipe = function () { //set wipe to have trails
|
||||
ctx.fillStyle = "rgba(255,255,255,0.005)";
|
||||
ctx.fillStyle = "rgba(255,255,255,0)";
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
@@ -730,33 +735,29 @@ const mech = {
|
||||
grabPowerUp() {
|
||||
//look for power ups to grab
|
||||
if (mech.fieldCDcycle < mech.cycle) {
|
||||
const grabPowerUpRange2 = (this.grabRange + 200) * (this.grabRange + 200)
|
||||
const grabPowerUpRange2 = (this.grabRange + 220) * (this.grabRange + 220)
|
||||
for (let i = 0, len = powerUp.length; i < len; ++i) {
|
||||
const dxP = mech.pos.x - powerUp[i].position.x;
|
||||
const dyP = mech.pos.y - powerUp[i].position.y;
|
||||
const dist2 = dxP * dxP + dyP * dyP;
|
||||
|
||||
// float towards player if looking at and in range or if very close to player
|
||||
if (dist2 < grabPowerUpRange2 && this.lookingAt(powerUp[i]) || dist2 < 14000) {
|
||||
if (dist2 < grabPowerUpRange2 && this.lookingAt(powerUp[i]) || dist2 < 16000) {
|
||||
if (dist2 < 5000) { //use power up if it is close enough
|
||||
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up
|
||||
x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.3,
|
||||
y: player.velocity.y + ((powerUp[i].velocity.y * powerUp[i].mass) / player.mass) * 0.3
|
||||
});
|
||||
mech.usePowerUp(i);
|
||||
return;
|
||||
}
|
||||
this.fieldMeter -= this.fieldRegen * 0.5;
|
||||
powerUp[i].force.x += 7 * (dxP / dist2) * powerUp[i].mass;
|
||||
powerUp[i].force.y += 7 * (dyP / dist2) * powerUp[i].mass - powerUp[i].mass * game.g; //negate gravity
|
||||
//extra friction
|
||||
Matter.Body.setVelocity(powerUp[i], {
|
||||
x: powerUp[i].velocity.x * 0.4,
|
||||
y: powerUp[i].velocity.y * 0.4
|
||||
x: powerUp[i].velocity.x * 0.11,
|
||||
y: powerUp[i].velocity.y * 0.11
|
||||
});
|
||||
if (dist2 < 5000) { //use power up if it is close enough
|
||||
//player knockback
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.2,
|
||||
y: player.velocity.y + ((powerUp[i].velocity.y * powerUp[i].mass) / player.mass) * 0.2
|
||||
});
|
||||
mech.usePowerUp(i);
|
||||
// this.fireCDcycle = mech.cycle + 10; //cool down
|
||||
return;
|
||||
}
|
||||
// return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -775,7 +776,6 @@ const mech = {
|
||||
//mob and player knock back
|
||||
const angle = Math.atan2(player.position.y - mob[i].position.y, player.position.x - mob[i].position.x);
|
||||
const mass = Math.min(Math.sqrt(mob[i].mass), 4);
|
||||
// console.log(mob[i].mass, Math.sqrt(mob[i].mass), mass)
|
||||
Matter.Body.setVelocity(mob[i], {
|
||||
x: player.velocity.x - (15 * Math.cos(angle)) / mass,
|
||||
y: player.velocity.y - (15 * Math.sin(angle)) / mass
|
||||
@@ -860,21 +860,21 @@ const mech = {
|
||||
pickUp() {
|
||||
//triggers when a hold target exits and field button is released
|
||||
this.isHolding = true;
|
||||
if (this.holdingTarget) {
|
||||
this.holdingTarget.collisionFilter.category = 0x010000;
|
||||
this.holdingTarget.collisionFilter.mask = 0x011111;
|
||||
}
|
||||
//combine momentum
|
||||
const px = player.velocity.x * player.mass + this.holdingTarget.velocity.x * this.holdingTarget.mass;
|
||||
const py = player.velocity.y * player.mass + this.holdingTarget.velocity.y * this.holdingTarget.mass;
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: px / (player.mass + this.holdingTarget.mass),
|
||||
y: py / (player.mass + this.holdingTarget.mass)
|
||||
});
|
||||
this.definePlayerMass(5 + this.holdingTarget.mass * this.holdingMassScale)
|
||||
//collide with nothing
|
||||
this.holdingTarget.collisionFilter.category = 0x000000;
|
||||
this.holdingTarget.collisionFilter.mask = 0x000000;
|
||||
// if (this.holdingTarget) {
|
||||
// this.holdingTarget.collisionFilter.category = 0x010000;
|
||||
// this.holdingTarget.collisionFilter.mask = 0x011111;
|
||||
// }
|
||||
// combine momentum // this doesn't feel right in game
|
||||
// const px = player.velocity.x * player.mass + this.holdingTarget.velocity.x * this.holdingTarget.mass;
|
||||
// const py = player.velocity.y * player.mass + this.holdingTarget.velocity.y * this.holdingTarget.mass;
|
||||
// Matter.Body.setVelocity(player, {
|
||||
// x: px / (player.mass + this.holdingTarget.mass),
|
||||
// y: py / (player.mass + this.holdingTarget.mass)
|
||||
// });
|
||||
},
|
||||
wakeCheck() {
|
||||
if (mech.isBodiesAsleep) {
|
||||
@@ -1007,7 +1007,7 @@ const mech = {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Electrostatic Force Field",
|
||||
name: "Electrostatic Field",
|
||||
description: "field does <strong>damage</strong> on contact<br> blocks are thrown at a higher velocity<br> increased field regeneration",
|
||||
effect: () => {
|
||||
mech.fieldMode = 2;
|
||||
@@ -1016,7 +1016,7 @@ const mech = {
|
||||
//throw quicker and harder
|
||||
mech.grabRange = 225;
|
||||
mech.fieldShieldingScale = 2;
|
||||
mech.fieldRegen *= 3;
|
||||
mech.fieldRegen *= 2;
|
||||
mech.throwChargeRate = 3;
|
||||
mech.throwChargeMax = 140;
|
||||
mech.fieldDamage = 5; //passive field does extra damage
|
||||
|
||||
@@ -47,7 +47,6 @@ const powerUps = {
|
||||
},
|
||||
effect() {
|
||||
const previousMode = b.mod
|
||||
|
||||
if (this.mode === null) { //this.mode is set if the power up has been ejected from player
|
||||
mode = b.mod //start with current mob
|
||||
while (mode === b.mod) {
|
||||
@@ -102,7 +101,7 @@ const powerUps = {
|
||||
},
|
||||
gun: {
|
||||
name: "gun",
|
||||
color: "#0cf",
|
||||
color: "#0bf",
|
||||
size() {
|
||||
return 30;
|
||||
},
|
||||
@@ -231,38 +230,4 @@ const powerUps = {
|
||||
}
|
||||
World.add(engine.world, powerUp[i]); //add to world
|
||||
},
|
||||
attractionLoop() {
|
||||
for (let i = 0, len = powerUp.length; i < len; ++i) {
|
||||
const dxP = player.position.x - powerUp[i].position.x;
|
||||
const dyP = player.position.y - powerUp[i].position.y;
|
||||
const dist2 = dxP * dxP + dyP * dyP;
|
||||
//gravitation for pickup
|
||||
if (dist2 < 100000 && (powerUp[i].name != "heal" || mech.health < 1)) {
|
||||
if (dist2 < 2000) {
|
||||
//knock back from grabbing power up
|
||||
Matter.Body.setVelocity(player, {
|
||||
x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.25,
|
||||
y: player.velocity.y + ((powerUp[i].velocity.y * powerUp[i].mass) / player.mass) * 0.25
|
||||
});
|
||||
mech.usePowerUp(i);
|
||||
break;
|
||||
}
|
||||
//power up needs to be able to see player to gravitate
|
||||
if (Matter.Query.ray(map, powerUp[i].position, player.position).length === 0) { // && Matter.Query.ray(body, powerUp[i].position, player.position).length === 0
|
||||
//extra friction
|
||||
Matter.Body.setVelocity(powerUp[i], {
|
||||
x: powerUp[i].velocity.x * 0.97,
|
||||
y: powerUp[i].velocity.y * 0.97
|
||||
});
|
||||
//float towards player
|
||||
powerUp[i].force.x += (dxP / dist2) * powerUp[i].mass * 1.6;
|
||||
powerUp[i].force.y += (dyP / dist2) * powerUp[i].mass * 1.6 - powerUp[i].mass * game.g; //negate gravity
|
||||
//draw the pulling effect
|
||||
ctx.globalAlpha = 0.2;
|
||||
mech.drawHold(powerUp[i], false);
|
||||
ctx.globalAlpha = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -137,7 +137,7 @@ summary {
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
z-index: 2;
|
||||
font-size: 19px;
|
||||
font-size: 20px;
|
||||
color: #000;
|
||||
text-align: right;
|
||||
opacity: 0.5;
|
||||
@@ -158,7 +158,7 @@ summary {
|
||||
line-height: 150%;
|
||||
text-align: center;
|
||||
z-index: 2;
|
||||
font-size: 1.3em;
|
||||
font-size: 1.25em;
|
||||
color: #000;
|
||||
opacity: 0;
|
||||
transition: opacity 0.5s;
|
||||
|
||||
Reference in New Issue
Block a user