double helix and timelike world line
This commit is contained in:
@@ -75,6 +75,7 @@ const b = {
|
|||||||
modGrenadeFragments: null,
|
modGrenadeFragments: null,
|
||||||
isModEnergyDamage: null,
|
isModEnergyDamage: null,
|
||||||
isModBotSpawner: null,
|
isModBotSpawner: null,
|
||||||
|
modWaveHelix: null,
|
||||||
modOnHealthChange() { //used with acid mod
|
modOnHealthChange() { //used with acid mod
|
||||||
if (b.isModAcidDmg && mech.health > 0.8) {
|
if (b.isModAcidDmg && mech.health > 0.8) {
|
||||||
b.modAcidDmg = 0.7
|
b.modAcidDmg = 0.7
|
||||||
@@ -1029,6 +1030,23 @@ const b = {
|
|||||||
b.modWaveSpeedBody = 0.25
|
b.modWaveSpeedBody = 0.25
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "double helix",
|
||||||
|
description: "<strong>wave beam</strong> emits <strong>two</strong> out of phase particles<br>wave particles do <strong>40%</strong> less <strong class='color-d'>damage</strong>",
|
||||||
|
maxCount: 1,
|
||||||
|
count: 0,
|
||||||
|
allowed() {
|
||||||
|
return b.haveGunCheck("wave beam")
|
||||||
|
},
|
||||||
|
requires: "wave beam",
|
||||||
|
effect() {
|
||||||
|
b.modWaveHelix = 2
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.modWaveHelix = 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "pocket universe",
|
name: "pocket universe",
|
||||||
description: "<strong>wave beam</strong> bullets last <strong>4</strong> times longer<br>bullets are <strong>confined</strong> to a <strong>region</strong> around player",
|
description: "<strong>wave beam</strong> bullets last <strong>4</strong> times longer<br>bullets are <strong>confined</strong> to a <strong>region</strong> around player",
|
||||||
@@ -1131,7 +1149,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "tinsellated flagella",
|
name: "tinsellated flagella",
|
||||||
description: "<strong class='color-p' style='letter-spacing: 2px;'>spores</strong> accelerate <strong>33% faster</strong>",
|
description: "<strong class='color-p' style='letter-spacing: 2px;'>spores</strong> accelerate <strong>50% faster</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -1245,6 +1263,22 @@ const b = {
|
|||||||
b.isModStunField = 0;
|
b.isModStunField = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "timelike world line",
|
||||||
|
description: "<strong>time dilation</strong> increases your time <strong>rate</strong> by <strong>2x</strong><br>while <strong class='color-f'>energy</strong> <strong>drain</strong> is decreased by <strong>2x</strong>",
|
||||||
|
maxCount: 9,
|
||||||
|
count: 0,
|
||||||
|
allowed() {
|
||||||
|
return mech.fieldUpgrades[mech.fieldMode].name === "time dilation field"
|
||||||
|
},
|
||||||
|
requires: "time dilation field",
|
||||||
|
effect() {
|
||||||
|
b.isModTimeSkip = true;
|
||||||
|
},
|
||||||
|
remove() {
|
||||||
|
b.isModTimeSkip = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "plasma jet",
|
name: "plasma jet",
|
||||||
description: "increase <strong>plasma torch's</strong> range by <strong>33%</strong>",
|
description: "increase <strong>plasma torch's</strong> range by <strong>33%</strong>",
|
||||||
@@ -1494,7 +1528,7 @@ const b = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
bulletActions() { //run in main loop
|
bulletRemove() { //run in main loop
|
||||||
//remove bullet if at end cycle for that bullet
|
//remove bullet if at end cycle for that bullet
|
||||||
let i = bullet.length;
|
let i = bullet.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
@@ -1508,7 +1542,8 @@ const b = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//draw
|
},
|
||||||
|
bulletDraw() {
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
for (let i = 0, len = bullet.length; i < len; i++) {
|
for (let i = 0, len = bullet.length; i < len; i++) {
|
||||||
let vertices = bullet[i].vertices;
|
let vertices = bullet[i].vertices;
|
||||||
@@ -1520,8 +1555,8 @@ const b = {
|
|||||||
}
|
}
|
||||||
ctx.fillStyle = "#000";
|
ctx.fillStyle = "#000";
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
|
},
|
||||||
//do bullet things
|
bulletDo() {
|
||||||
for (let i = 0, len = bullet.length; i < len; i++) {
|
for (let i = 0, len = bullet.length; i < len; i++) {
|
||||||
bullet[i].do();
|
bullet[i].do();
|
||||||
}
|
}
|
||||||
@@ -1962,7 +1997,7 @@ const b = {
|
|||||||
angle: Math.random() * 2 * Math.PI,
|
angle: Math.random() * 2 * Math.PI,
|
||||||
friction: 0,
|
friction: 0,
|
||||||
frictionAir: 0.025,
|
frictionAir: 0.025,
|
||||||
thrust: b.isModFastSpores ? 0.0008 : 0.0004,
|
thrust: b.isModFastSpores ? 0.001 : 0.0004,
|
||||||
dmg: 2.4, //damage done in addition to the damage from momentum
|
dmg: 2.4, //damage done in addition to the damage from momentum
|
||||||
classType: "bullet",
|
classType: "bullet",
|
||||||
collisionFilter: {
|
collisionFilter: {
|
||||||
@@ -1971,7 +2006,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
endCycle: game.cycle + Math.floor((660 + Math.floor(Math.random() * 240)) * b.isModBulletsLastLonger),
|
endCycle: game.cycle + Math.floor((660 + Math.floor(Math.random() * 240)) * b.isModBulletsLastLonger),
|
||||||
minDmgSpeed: 0,
|
minDmgSpeed: 0,
|
||||||
onDmg() {
|
onDmg(who) {
|
||||||
// mobs.statusPoison(who, 0.5, 180) // (2.2) * 1.3 * 30/180 // 6 ticks (3 seconds)
|
// mobs.statusPoison(who, 0.5, 180) // (2.2) * 1.3 * 30/180 // 6 ticks (3 seconds)
|
||||||
this.endCycle = 0; //bullet ends cycle after doing damage
|
this.endCycle = 0; //bullet ends cycle after doing damage
|
||||||
},
|
},
|
||||||
@@ -2608,13 +2643,15 @@ const b = {
|
|||||||
isStarterGun: true,
|
isStarterGun: true,
|
||||||
isEasyToAim: false,
|
isEasyToAim: false,
|
||||||
fire() {
|
fire() {
|
||||||
const me = bullet.length;
|
mech.fireCDcycle = mech.cycle + Math.floor(3 * b.modFireRate); // cool down
|
||||||
const dir = mech.angle
|
const dir = mech.angle
|
||||||
const SPEED = 10
|
const SPEED = 10
|
||||||
const wiggleMag = mech.crouch ? 3 : 10
|
const wiggleMag = mech.crouch ? 5 : 12
|
||||||
|
for (let i = 0; i < b.modWaveHelix; i++) {
|
||||||
|
const me = bullet.length;
|
||||||
bullet[me] = Bodies.polygon(mech.pos.x + 25 * Math.cos(dir), mech.pos.y + 25 * Math.sin(dir), 7, 5 * b.modBulletSize, {
|
bullet[me] = Bodies.polygon(mech.pos.x + 25 * Math.cos(dir), mech.pos.y + 25 * Math.sin(dir), 7, 5 * b.modBulletSize, {
|
||||||
angle: dir,
|
angle: dir,
|
||||||
cycle: 0,
|
cycle: -0.5,
|
||||||
endCycle: game.cycle + Math.floor((b.isModWaveReflect ? 480 : 120) * b.isModBulletsLastLonger),
|
endCycle: game.cycle + Math.floor((b.isModWaveReflect ? 480 : 120) * b.isModBulletsLastLonger),
|
||||||
inertia: Infinity,
|
inertia: Infinity,
|
||||||
frictionAir: 0,
|
frictionAir: 0,
|
||||||
@@ -2644,7 +2681,7 @@ const b = {
|
|||||||
for (let i = 0; i < q.length; i++) {
|
for (let i = 0; i < q.length; i++) {
|
||||||
slowCheck = 0.3;
|
slowCheck = 0.3;
|
||||||
Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium
|
Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium
|
||||||
let dmg = b.dmgScale * 0.45 / Math.sqrt(q[i].mass)
|
let dmg = b.dmgScale * 0.43 / Math.sqrt(q[i].mass) * (b.modWaveHelix ? 0.6 : 1) //1 - 0.4 = 0.6 for helix mod 40% damage reduction
|
||||||
q[i].damage(dmg);
|
q[i].damage(dmg);
|
||||||
q[i].foundPlayer();
|
q[i].foundPlayer();
|
||||||
game.drawList.push({ //add dmg to draw queue
|
game.drawList.push({ //add dmg to draw queue
|
||||||
@@ -2662,7 +2699,7 @@ const b = {
|
|||||||
Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(this.velocity), SPEED * slowCheck));
|
Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(this.velocity), SPEED * slowCheck));
|
||||||
}
|
}
|
||||||
this.cycle++
|
this.cycle++
|
||||||
const wiggle = Vector.mult(transverse, wiggleMag * Math.cos(this.cycle * 0.35))
|
const wiggle = Vector.mult(transverse, wiggleMag * Math.cos(this.cycle * 0.35) * ((i % 2) ? -1 : 1))
|
||||||
Matter.Body.setPosition(this, Vector.add(this.position, wiggle))
|
Matter.Body.setPosition(this, Vector.add(this.position, wiggle))
|
||||||
}
|
}
|
||||||
// if (b.isModWaveReflect) { //single reflection
|
// if (b.isModWaveReflect) { //single reflection
|
||||||
@@ -2702,13 +2739,13 @@ const b = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
World.add(engine.world, bullet[me]); //add bullet to world
|
World.add(engine.world, bullet[me]); //add bullet to world
|
||||||
mech.fireCDcycle = mech.cycle + Math.floor(3 * b.modFireRate); // cool down
|
|
||||||
Matter.Body.setVelocity(bullet[me], {
|
Matter.Body.setVelocity(bullet[me], {
|
||||||
x: SPEED * Math.cos(dir),
|
x: SPEED * Math.cos(dir),
|
||||||
y: SPEED * Math.sin(dir)
|
y: SPEED * Math.sin(dir)
|
||||||
});
|
});
|
||||||
const transverse = Vector.normalise(Vector.perp(bullet[me].velocity))
|
const transverse = Vector.normalise(Vector.perp(bullet[me].velocity))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "missiles",
|
name: "missiles",
|
||||||
@@ -3032,7 +3069,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: 11,
|
ammoPack: 12,
|
||||||
have: false,
|
have: false,
|
||||||
isStarterGun: true,
|
isStarterGun: true,
|
||||||
isEasyToAim: true,
|
isEasyToAim: true,
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ const game = {
|
|||||||
level.drawFills();
|
level.drawFills();
|
||||||
game.draw.drawMapPath();
|
game.draw.drawMapPath();
|
||||||
b.fire();
|
b.fire();
|
||||||
b.bulletActions();
|
b.bulletRemove();
|
||||||
|
b.bulletDraw();
|
||||||
|
b.bulletDo();
|
||||||
game.drawCircle();
|
game.drawCircle();
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
game.drawCursor();
|
game.drawCursor();
|
||||||
@@ -74,7 +76,8 @@ const game = {
|
|||||||
|
|
||||||
mech.hold();
|
mech.hold();
|
||||||
b.fire();
|
b.fire();
|
||||||
b.bulletActions();
|
b.bulletRemove();
|
||||||
|
b.bulletDo();
|
||||||
}
|
}
|
||||||
game.isTimeSkipping = false;
|
game.isTimeSkipping = false;
|
||||||
},
|
},
|
||||||
@@ -174,7 +177,7 @@ const game = {
|
|||||||
if (b.inventory[0] === b.activeGun) {
|
if (b.inventory[0] === b.activeGun) {
|
||||||
let lessDamage = 1
|
let lessDamage = 1
|
||||||
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
for (let i = 0, len = b.inventory.length; i < len; i++) {
|
||||||
lessDamage *= 0.87 // 1 - 0.13
|
lessDamage *= 0.84 // 1 - 0.16
|
||||||
}
|
}
|
||||||
document.getElementById("mod-entanglement").innerHTML = " " + ((1 - lessDamage) * 100).toFixed(0) + "%"
|
document.getElementById("mod-entanglement").innerHTML = " " + ((1 - lessDamage) * 100).toFixed(0) + "%"
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
26
js/player.js
26
js/player.js
@@ -723,6 +723,7 @@ const mech = {
|
|||||||
fieldEnergyMax: 1, //can be increased by a mod
|
fieldEnergyMax: 1, //can be increased by a mod
|
||||||
holdingTarget: null,
|
holdingTarget: null,
|
||||||
fieldShieldingScale: 1,
|
fieldShieldingScale: 1,
|
||||||
|
timeSkipLastCycle: 0,
|
||||||
// these values are set on reset by setHoldDefaults()
|
// these values are set on reset by setHoldDefaults()
|
||||||
fieldRange: 155,
|
fieldRange: 155,
|
||||||
energy: 0,
|
energy: 0,
|
||||||
@@ -1339,7 +1340,32 @@ const mech = {
|
|||||||
cons[i].stiffness = 0;
|
cons[i].stiffness = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
game.cycle--; //pause all functions that depend on game cycle increasing
|
game.cycle--; //pause all functions that depend on game cycle increasing
|
||||||
|
if (b.isModTimeSkip) {
|
||||||
|
game.isTimeSkipping = true;
|
||||||
|
mech.cycle++;
|
||||||
|
game.gravity();
|
||||||
|
Engine.update(engine, game.delta);
|
||||||
|
// level.checkZones();
|
||||||
|
// level.checkQuery();
|
||||||
|
mech.move();
|
||||||
|
game.checks();
|
||||||
|
// mobs.loop();
|
||||||
|
// mech.draw();
|
||||||
|
mech.walk_cycle += mech.flipLegs * mech.Vx;
|
||||||
|
// mech.hold();
|
||||||
|
mech.energy += 0.5 * DRAIN; //x1 to undo the energy drain from time speed up, x1.5 to cut energy drain in half
|
||||||
|
b.fire();
|
||||||
|
// b.bulletRemove();
|
||||||
|
b.bulletDo();
|
||||||
|
game.isTimeSkipping = false;
|
||||||
|
}
|
||||||
|
// game.cycle--; //pause all functions that depend on game cycle increasing
|
||||||
|
// if (b.isModTimeSkip && !game.isTimeSkipping) { //speed up the rate of time
|
||||||
|
// game.timeSkip(1)
|
||||||
|
// mech.energy += 1.5 * DRAIN; //x1 to undo the energy drain from time speed up, x1.5 to cut energy drain in half
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle) { //holding, but field button is released
|
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle) { //holding, but field button is released
|
||||||
mech.wakeCheck();
|
mech.wakeCheck();
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ const spawn = {
|
|||||||
},
|
},
|
||||||
randomLevelBoss(x, y) {
|
randomLevelBoss(x, y) {
|
||||||
// suckerBoss, laserBoss, tetherBoss, snakeBoss all need a particular level to work so they are not included
|
// suckerBoss, laserBoss, tetherBoss, snakeBoss all need a particular level to work so they are not included
|
||||||
const options = ["shooterBoss", "cellBossCulture", "bomberBoss", "timeSkipBoss"]
|
const options = ["shooterBoss", "cellBossCulture", "bomberBoss"] //, "timeSkipBoss"
|
||||||
// const options = ["timeSkipBoss"]
|
// const options = ["timeSkipBoss"]
|
||||||
spawn[options[Math.floor(Math.random() * options.length)]](x, y)
|
spawn[options[Math.floor(Math.random() * options.length)]](x, y)
|
||||||
},
|
},
|
||||||
@@ -644,7 +644,7 @@ const spawn = {
|
|||||||
let me = mob[mob.length - 1];
|
let me = mob[mob.length - 1];
|
||||||
// me.stroke = "transparent"; //used for drawSneaker
|
// me.stroke = "transparent"; //used for drawSneaker
|
||||||
me.timeSkipLastCycle = 0
|
me.timeSkipLastCycle = 0
|
||||||
me.eventHorizon = 2000; //required for black hole
|
me.eventHorizon = 1600; //required for black hole
|
||||||
me.seeAtDistance2 = (me.eventHorizon + 2000) * (me.eventHorizon + 2000); //vision limit is event horizon + 2000
|
me.seeAtDistance2 = (me.eventHorizon + 2000) * (me.eventHorizon + 2000); //vision limit is event horizon + 2000
|
||||||
me.accelMag = 0.0004 * game.accelScale;
|
me.accelMag = 0.0004 * game.accelScale;
|
||||||
// me.frictionAir = 0.005;
|
// me.frictionAir = 0.005;
|
||||||
|
|||||||
5
todo.txt
5
todo.txt
@@ -1,9 +1,14 @@
|
|||||||
mod - your damage scales with current energy
|
mod - your damage scales with current energy
|
||||||
mod - 10% chance after killing a mob to gain a bot
|
mod - 10% chance after killing a mob to gain a bot
|
||||||
that follows you until you exit the map
|
that follows you until you exit the map
|
||||||
|
mod - move extra fast with less energy cost in time dilation
|
||||||
|
mod - double helix fire two wave bullets, but they do 40% less damage
|
||||||
|
|
||||||
************** TODO - n-gon **************
|
************** TODO - n-gon **************
|
||||||
|
|
||||||
|
boss level for timeSkipBoss because of game instability for boss on normal levels
|
||||||
|
boss level needs to be very simple (maybe no other mobs, or no random mobs)
|
||||||
|
|
||||||
mod - you can no longer see your current health
|
mod - you can no longer see your current health
|
||||||
|
|
||||||
boss mob - just a faster and larger version of a springer mob
|
boss mob - just a faster and larger version of a springer mob
|
||||||
|
|||||||
Reference in New Issue
Block a user