diff --git a/.DS_Store b/.DS_Store index 49bb66f..dc2b166 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/js/bullet.js b/js/bullet.js index dcc7fcc..b18d2a6 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -3625,7 +3625,7 @@ const b = { ammoPack: 100, have: false, wavePacketCycle: 0, - delay: 60, + delay: 40, do() { if (this.wavePacketCycle && !input.fire) { this.wavePacketCycle = 0; diff --git a/js/level.js b/js/level.js index 03f5767..af4bfe0 100644 --- a/js/level.js +++ b/js/level.js @@ -436,6 +436,32 @@ const level = { y: this.velocity.y }); }, + off() { + Matter.Body.setPosition(this, { + x: x, + y: this.position.y + }); + Matter.Body.setVelocity(this, { + x: 0, + y: this.velocity.y + }); + }, + constraint: this.null, + addConstraint() { + this.constraint = Constraint.create({ + pointA: { + x: this.position.x, + y: this.position.y + }, + bodyB: this, + stiffness: 0.01, + damping: 0.3 + }); + World.add(engine.world, this.constraint); + }, + removeConstraint() { + World.remove(engine.world, this.constraint, true) + }, drawTrack() { ctx.fillStyle = "#ccc" ctx.fillRect(x, y, 5, yTravel) @@ -1932,7 +1958,7 @@ const level = { if (tech.isDuplicateBoss && Math.random() < 2 * tech.duplicationChance()) spawn.randomLevelBoss(7725, 2275); }, satellite() { - const elevator = level.elevator(4210, -1297, 380, 85, -3450) //, 0.003, { up: 0.01, down: 0.2 } + const elevator = level.elevator(4210, -1285, 380, 70, -3450) //, 0.003, { up: 0.01, down: 0.2 } level.custom = () => { ctx.fillStyle = "#d4f4f4" ctx.fillRect(-250, -750, 420, 450) @@ -1961,20 +1987,6 @@ const level = { ctx.fillRect(4000, -1200, 1050, 1500) ctx.fillRect(4100, -3450, 600, 2250) elevator.move() - // elevator.drawTrack() //looks ugly - // if (elevator.pauseUntilCycle < simulation.cycle && !m.isBodiesAsleep) { //elevator move - // if (elevator.pointA.y > -1275) { //bottom - // elevator.plat.speed = -10 - // elevator.pauseUntilCycle = simulation.cycle + 90 - // } else if (elevator.pointA.y < -3455) { //top - // elevator.plat.speed = 30 - // elevator.pauseUntilCycle = simulation.cycle + 90 - // } - // elevator.pointA = { - // x: elevator.pointA.x, - // y: elevator.pointA.y + elevator.plat.speed - // } - // } }; level.setPosToSpawn(-100, 210); //normal spawn @@ -2051,7 +2063,7 @@ const level = { //steep stairs spawn.mapRect(4100, -2250, 100, 650); - spawn.mapRect(4100, -3450, 100, 650); //left top shelf + spawn.mapRect(4100, -3450, 100, 850); //left top shelf spawn.mapRect(4600, -3450, 100, 1850); spawn.randomSmallMob(4400, -3500); @@ -2093,7 +2105,7 @@ const level = { if (tech.isDuplicateBoss && Math.random() < 2 * tech.duplicationChance()) spawn.randomLevelBoss(3950, -850); }, rooftops() { - const elevator = level.elevator(1450, -1000, 235, 50, -2000) + const elevator = level.elevator(1450, -990, 235, 45, -2000) level.custom = () => { elevator.move(); elevator.drawTrack(); @@ -2543,54 +2555,6 @@ const level = { if (tech.isDuplicateBoss && Math.random() < 2 * tech.duplicationChance()) spawn.randomLevelBoss(3075, -2050); }, highrise() { - const isBlockMode = false - let slideBlock - if (isBlockMode) { - const x = -2750 - const yMax = -1500 - slideBlock = body[body.length] = Bodies.rectangle(x, -700, 200, 100, { - collisionFilter: { - category: cat.body, - mask: cat.player | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet //cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet - }, - inertia: Infinity, //prevents rotation - isNotHoldable: true, - friction: 1, - frictionStatic: 1, - frictionAir: 0.001, - // restitution: 0, - isUp: true, - move() { - if (this.isUp) { - if (this.position.y > yMax) { - this.force.y -= 0.01 * this.mass - } else { - this.isUp = false - Matter.Body.setPosition(this, { - x: x, - y: yMax - }); - Matter.Body.setVelocity(this, { - x: 0, - y: 0 - }); - } - } else if (this.position.y > -800) { - this.isUp = true - } - }, - holdHorizontal() { - Matter.Body.setPosition(this, { - x: x, - y: this.position.y - }); - Matter.Body.setVelocity(this, { - x: 0, - y: this.velocity.y - }); - } - }); - } level.custom = () => { ctx.fillStyle = "#d0d0d2" ctx.fillRect(-2475, -2450, 25, 750) @@ -2602,43 +2566,24 @@ const level = { level.exit.draw(); level.enter.draw(); }; - if (isBlockMode) { - level.customTopLayer = () => { - ctx.fillStyle = "rgba(64,64,64,0.97)" //hidden section - ctx.fillRect(-4450, -750, 800, 200) - ctx.fillStyle = "rgba(0,0,0,0.12)" - ctx.fillRect(-1830, -1150, 2030, 1150) - ctx.fillRect(-3410, -2150, 495, 1550) - ctx.fillRect(-2585, -1675, 420, 1125) - ctx.fillRect(-1640, -1575, 540, 425) - //move sliding block - slideBlock.move() - slideBlock.holdHorizontal() //keep horizontal position constant - - - - }; - } else { - level.customTopLayer = () => { - ctx.fillStyle = "rgba(64,64,64,0.97)" //hidden section - ctx.fillRect(-4450, -750, 800, 200) - ctx.fillStyle = "rgba(0,0,0,0.12)" - ctx.fillRect(-1830, -1150, 2030, 1150) - ctx.fillRect(-3410, -2150, 495, 1550) - ctx.fillRect(-2585, -1675, 420, 1125) - ctx.fillRect(-1640, -1575, 540, 425) - ctx.fillStyle = "rgba(200,0,255,0.2)"; //boost - ctx.fillRect(-750, -25, 100, 25); - ctx.fillRect(-2800, -625, 100, 25); - ctx.fillStyle = "rgba(200,0,255,0.1)"; //boost - ctx.fillRect(-750, -55, 100, 55); - ctx.fillRect(-2800, -655, 100, 55); - ctx.fillStyle = "rgba(200,0,255,0.05)"; //boost - ctx.fillRect(-750, -120, 100, 120); - ctx.fillRect(-2800, -720, 100, 120); - }; - } - + level.customTopLayer = () => { + ctx.fillStyle = "rgba(64,64,64,0.97)" //hidden section + ctx.fillRect(-4450, -750, 800, 200) + ctx.fillStyle = "rgba(0,0,0,0.12)" + ctx.fillRect(-1830, -1150, 2030, 1150) + ctx.fillRect(-3410, -2150, 495, 1550) + ctx.fillRect(-2585, -1675, 420, 1125) + ctx.fillRect(-1640, -1575, 740, 425) + ctx.fillStyle = "rgba(200,0,255,0.2)"; //boost + ctx.fillRect(-750, -25, 100, 25); + ctx.fillRect(-2800, -625, 100, 25); + ctx.fillStyle = "rgba(200,0,255,0.1)"; //boost + ctx.fillRect(-750, -55, 100, 55); + ctx.fillRect(-2800, -655, 100, 55); + ctx.fillStyle = "rgba(200,0,255,0.05)"; //boost + ctx.fillRect(-750, -120, 100, 120); + ctx.fillRect(-2800, -720, 100, 120); + }; level.setPosToSpawn(-300, -700); //normal spawn spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20); @@ -2676,14 +2621,68 @@ const level = { spawn.mapRect(-600, -1075, 50, 475); spawn.mapRect(-600, -650, 625, 50); spawn.mapRect(-1300, -650, 500, 50); - spawn.mapRect(-175, -250, 425, 300); spawn.bodyRect(-75, -300, 50, 50); - spawn.boost(-750, 0, 1700); + if (Math.random() < 0.6) { + const elevator = level.elevator(-790, -190, 180, 25, -1150) //, 0.007 + elevator.addConstraint(); + button = level.button(-500, -200) + + spawn.mapRect(-600, -200, 500, 250); //ledge for boarding elevator + spawn.bodyRect(-250, -300, 100, 100); //a nice block near the elevator + level.customTopLayer = () => { + button.query(); + button.draw(); + if (button.isUp) { + if (elevator.isOn) { + elevator.isOn = false + elevator.frictionAir = 0.2 + elevator.addConstraint(); + } + } else { + if (!elevator.isOn) { + elevator.isOn = true + elevator.isUp = true + elevator.removeConstraint(); + elevator.frictionAir = 0.01 //elevator.isUp ? 0.01 : 0.2 + } + } + if (elevator.isOn) { + elevator.move(); + ctx.fillStyle = "#000" + ctx.fillRect(-700, -1140, 1, 975) + } else { + ctx.fillStyle = "#999" + ctx.fillRect(-700, -1140, 1, 975) + } + + ctx.fillStyle = "rgba(64,64,64,0.97)" //hidden section + ctx.fillRect(-4450, -750, 800, 200) + ctx.fillStyle = "rgba(0,0,0,0.12)" + ctx.fillRect(-1830, -1150, 2030, 1150) + ctx.fillRect(-3410, -2150, 495, 1550) + ctx.fillRect(-2585, -1675, 420, 1125) + ctx.fillRect(-1640, -1575, 740, 425) + ctx.fillStyle = "rgba(200,0,255,0.2)"; //boost + ctx.fillRect(-2800, -625, 100, 25); + ctx.fillStyle = "rgba(200,0,255,0.1)"; //boost + ctx.fillRect(-2800, -655, 100, 55); + ctx.fillStyle = "rgba(200,0,255,0.05)"; //boost + ctx.fillRect(-2800, -720, 100, 120); + }; + + } else { + spawn.boost(-750, 0, 1700); + spawn.bodyRect(-825, -1160, 250, 10); + spawn.mapRect(-175, -250, 425, 300); + } + + + spawn.bodyRect(-425, -1375, 400, 225); - spawn.mapRect(-1125, -1575, 50, 475); + spawn.mapRect(-925, -1575, 50, 475); spawn.bodyRect(-1475, -1275, 250, 125); - spawn.bodyRect(-825, -1160, 250, 10); - spawn.mapRect(-1650, -1575, 400, 50); + + spawn.mapRect(-1650, -1575, 600, 50); spawn.mapRect(-600, -1150, 850, 175); spawn.mapRect(-1850, -1150, 1050, 175); spawn.bodyRect(-1907, -1600, 550, 25); @@ -2698,7 +2697,7 @@ const level = { spawn.mapRect(-4450, -600, 2300, 750); spawn.mapRect(-2225, -450, 175, 550); // spawn.mapRect(-2600, -975, 450, 50); - if (!isBlockMode) spawn.boost(-2800, -600, 950); + spawn.boost(-2800, -600, 950); spawn.mapRect(-3425, -1325, 525, 50); spawn.mapRect(-3425, -2200, 525, 50); spawn.mapRect(-2600, -1700, 450, 50); diff --git a/js/player.js b/js/player.js index 2887a2a..76a7d3f 100644 --- a/js/player.js +++ b/js/player.js @@ -2856,12 +2856,6 @@ const m = { } m.look = () => { //disable mouse aiming - //always on mouse look - // m.angle = Math.atan2( - // simulation.mouseInGame.y - m.pos.y, - // simulation.mouseInGame.x - m.pos.x - // ); - //smoothed mouse look translations const scale = 0.8; m.transSmoothX = canvas.width2 - m.pos.x - (simulation.mouse.x - canvas.width2) * scale; m.transSmoothY = canvas.height2 - m.pos.y - (simulation.mouse.y - canvas.height2) * scale; diff --git a/js/simulation.js b/js/simulation.js index 4414782..52c3a94 100644 --- a/js/simulation.js +++ b/js/simulation.js @@ -517,6 +517,7 @@ const simulation = { } m.look = m.lookDefault + level.levels = level.playableLevels.slice(0) //copy array, not by just by assignment if (simulation.isCommunityMaps) { level.levels.push("stronghold"); @@ -539,6 +540,7 @@ const simulation = { } else { level.levels = shuffle(level.levels); //shuffles order of maps } + level.levels.unshift("intro"); //add level to the start of the randomized levels list level.levels.push("gauntlet"); //add level to the end of the randomized levels list level.levels.push("final"); //add level to the end of the randomized levels list diff --git a/js/spawn.js b/js/spawn.js index 9c30779..6cbf652 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -1266,7 +1266,7 @@ const spawn = { let targets = [] //track who is in the node boss, for shields mobs.spawn(x, y, 6, radius, "#b386e8"); let me = mob[mob.length - 1]; - Matter.Body.setDensity(me, 0.0015); //extra dense //normal is 0.001 //makes effective life much larger + Matter.Body.setDensity(me, 0.004); //extra dense //normal is 0.001 //makes effective life much larger me.isBoss = true; targets.push(me.id) //add to shield protection me.friction = 0; @@ -1328,7 +1328,7 @@ const spawn = { for (let i = 0; i < nodes; ++i) { spawn.stabber(x + sideLength * Math.sin(i * angle), y + sideLength * Math.cos(i * angle), radius, 12); - Matter.Body.setDensity(mob[mob.length - 1], 0.002); //extra dense //normal is 0.001 //makes effective life much larger + Matter.Body.setDensity(mob[mob.length - 1], 0.004); //extra dense //normal is 0.001 //makes effective life much larger targets.push(mob[mob.length - 1].id) //track who is in the node boss, for shields } @@ -3347,7 +3347,7 @@ const spawn = { me.seeAtDistance2 = 2000000; me.memory = Infinity; me.frictionAir = 0.01; - me.accelMag = 0.00004 * simulation.accelScale; + me.accelMag = 0.00003 * simulation.accelScale; me.collisionFilter.mask = cat.player | cat.bullet //| cat.body spawn.shield(me, x, y, 1); diff --git a/todo.txt b/todo.txt index 63e7c84..c4afa57 100644 --- a/todo.txt +++ b/todo.txt @@ -1,17 +1,14 @@ ******************************************************** NEXT PATCH ******************************************************** -jump now applies the velocity of the block you jumped off of - it might feel slightly different if you play n-gon often - it could add some bugs so let me know -elevators have more realistic physics - you can jump off them when they get to the top (fun!) - blocks interact with them in a more healthy way (no bleed through) - they can have a wider range of healthy speeds - it can hurt mobs + ******************************************************** BUGS ******************************************************** +figure out how to undo ship mode + if you die in ship mode it respawns with m.look set to non ship methods + look is set in many tech and in startGame + Why does micro-extruder lag so much blue triangle boss can move backwards and aim away from you if set up properly @@ -54,25 +51,12 @@ is there a way to check if the player is stuck inside the map or block ******************************************************** TODO ******************************************************** -platform: jumps a bit before moving up - you can't use set position for y, because blocks drag a bit inside the platform - get delays working right - do something if the force is overwhelmed so much the platform moves backwards, or below lower/upper range - apply a constraint when still and remove it when moving - also apply thr constraint if the block goes outside normal bounds by too much - -should jump velocity add to current velocity? - maybe only add the velocity of what the player is standing on - mob: molecule shapes - 2 separate mobs joined by a bond use constraints: just spawn 2x or 3x groupings low friction so they can spin around spin when attacking player? increase constraint length when attacking - -make nano-scale upgrades all cost research, and buff those tech - make most future tech for guns / fields tech: mine - fire the mine into where you were in the past @@ -81,9 +65,10 @@ tech: mine - fire the mine into where you were in the past tech: increase health and harm taken remove air control - negative tech, junk , experiment? + negative tech aspect, junk , experiment? -use name axion as a 3rd dark matter tech +add falling damage + negative tech aspect tech: use the ability for power ups to have custom code (note: this code is half way done, it just needs to be completed) @@ -413,6 +398,8 @@ possible names for tech dynamical systems quantum zeno effect (perturbation of a system prevents some systems from evolving because it scrambles coherence) (apply to lasers, fields) counterfactual - something false + axion - maybe a 3rd dark matter type tech + plot script: