From 1966173f888e0e874fd0c1d81e7cacfe45d0d81d Mon Sep 17 00:00:00 2001 From: landgreen Date: Fri, 29 Nov 2024 18:47:49 -0800 Subject: [PATCH] moving files to different computer reworked focuser mobs to fire blue energy draining laser instead of charging player --- js/level.js | 47 ++++++++++++++++++-- js/spawn.js | 101 ++++++++++++++++++++++++++++++++++-------- todo.txt | 123 ++++++---------------------------------------------- 3 files changed, 142 insertions(+), 129 deletions(-) diff --git a/js/level.js b/js/level.js index 7b3a592..90a790f 100644 --- a/js/level.js +++ b/js/level.js @@ -60,12 +60,12 @@ const level = { // for (let i = 0; i < 1; i++) powerUps.directSpawn(450, -50, "warp"); // for (let i = 0; i < 7; i++) powerUps.directSpawn(m.pos.x + 200, m.pos.y - 250, "research", false); // spawn.bodyRect(575, -700, 150, 150); //block mob line of site on testing - // level.substructure(); + // level.cocoon(); level[simulation.isTraining ? "walk" : "initial"]() //normal starting level ************************************************** - // for (let i = 0; i < 5; ++i) spawn.sneaker(1900, -500) + // for (let i = 0; i < 1; ++i) spawn.shieldingBoss(1900, -500) // for (let i = 0; i < 1; i++) spawn.mantisBoss(1900, -500) // for (let i = 0; i < 1; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "entanglement"); @@ -3093,8 +3093,9 @@ const level = { // ctx.font = "50px Arial"; // ctx.fillStyle = "rgba(0,0,0,0.3)" // for (let i = 0; i < 5; i++) { - // const wiggle = 10 + // const wiggle = 2 // ctx.fillText("move", 500 + wiggle * Math.random(), -500 + wiggle * Math.random()); + // ctx.fillText("move", 500, -400); // } //push around power ups stuck in the tube wall @@ -8154,6 +8155,46 @@ const level = { powerUps.directSpawn(2100, 925, "heal"); powerUps.directSpawn(625, -100, "heal"); }, + cocoon() { + // simulation.fallHeight = 4000 + level.announceMobTypes() + level.setPosToSpawn(-3800, 950); + level.exit.x = 3750 + level.exit.y = -625 + level.defaultZoom = 2000 + simulation.zoomTransition(level.defaultZoom) + document.body.style.backgroundColor = "#d0d5d5"; + color.map = "#444" + + + + + + level.custom = () => { + level.exit.drawAndCheck(); + level.enter.draw(); + }; + level.customTopLayer = () => { + ctx.fillStyle = "rgba(0,255,255,0.1)" //"#d4f4f4" //exit + ctx.fillRect(3535, -1050, 500, 475); + + //shadows + ctx.fillStyle = "rgba(0,20,60,0.09)" + // ctx.fillRect(-4025, -1050, 1750, 2275); + }; + //boxes center on zero,zero with deep walls to hide background + spawn.mapRect(4000, -2000, 2000, 4000); //right map wall + spawn.mapRect(-6000, -2000, 2000, 4000); //left map wall + spawn.mapRect(-6000, -4000, 12000, 3000); //map ceiling + spawn.mapRect(-6000, 1000, 12000, 3000); //floor + + + // spawn.randomMob(2825, 75, 0.9); + // spawn.randomLevelBoss(2400, 600); + // spawn.secondaryBossChance(800, -300) + // powerUps.spawnStartingPowerUps(600, 375); + // powerUps.addResearchToLevel() //needs to run after mobs are spawned + }, lock() { level.announceMobTypes() level.setPosToSpawn(0, -65); //lower start diff --git a/js/spawn.js b/js/spawn.js index a5bd699..b2eb361 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -3089,28 +3089,32 @@ const spawn = { if (this.seePlayer.yes && dist2 < 4000000) { const rangeWidth = 2000; //this is sqrt of 4000000 from above if() //targeting laser will slowly move from the mob to the player's position - this.laserPos = Vector.add(this.laserPos, Vector.mult(Vector.sub(player.position, this.laserPos), 0.1)); + this.laserPos = Vector.add(this.laserPos, Vector.mult(Vector.sub(player.position, this.laserPos), 0.03)); let targetDist = Vector.magnitude(Vector.sub(this.laserPos, m.pos)); const r = 12; ctx.beginPath(); ctx.moveTo(this.position.x, this.position.y); if (targetDist < r + 16) { targetDist = r + 10; - //charge at player - const forceMag = this.accelMag * 40 * this.mass; - const angle = Math.atan2(this.seePlayer.position.y - this.position.y, this.seePlayer.position.x - this.position.x); - this.force.x += forceMag * Math.cos(angle); - this.force.y += forceMag * Math.sin(angle); - } - // else { - //high friction if can't lock onto player - // Matter.Body.setVelocity(this, { - // x: this.velocity.x * 0.98, - // y: this.velocity.y * 0.98 - // }); - // } - if (dist2 > 80000) { - const laserWidth = 0.002; + if (m.immuneCycle < m.cycle) { + m.damage(0.0003 * simulation.dmgScale); + if (m.energy > 0.1) m.energy -= 0.003 + } + ctx.beginPath(); + ctx.moveTo(this.position.x, this.position.y); + ctx.lineTo(m.pos.x, m.pos.y); + ctx.lineTo(m.pos.x + (Math.random() - 0.5) * 3000, m.pos.y + (Math.random() - 0.5) * 3000); + ctx.lineWidth = 2; + ctx.strokeStyle = "rgb(0,0,255)"; + ctx.setLineDash([125 * Math.random(), 125 * Math.random()]); + ctx.stroke(); + ctx.setLineDash([]); + ctx.beginPath(); + ctx.arc(m.pos.x, m.pos.y, 40, 0, 2 * Math.PI); + ctx.fillStyle = "rgba(0,0,255,0.1)"; + ctx.fill(); + } else { + const laserWidth = 0.0005; let laserOffR = Vector.rotateAbout(this.laserPos, (targetDist - r) * laserWidth, this.position); let sub = Vector.normalise(Vector.sub(laserOffR, this.position)); laserOffR = Vector.add(laserOffR, Vector.mult(sub, rangeWidth)); @@ -3120,7 +3124,7 @@ const spawn = { sub = Vector.normalise(Vector.sub(laserOffL, this.position)); laserOffL = Vector.add(laserOffL, Vector.mult(sub, rangeWidth)); ctx.lineTo(laserOffL.x, laserOffL.y); - ctx.fillStyle = `rgba(0,0,255,${Math.max(0, 0.3 * r / targetDist)})` + ctx.fillStyle = `rgba(0,0,255,${Math.max(0, 0.6 * r / targetDist)})` ctx.fill(); } } else { @@ -3128,6 +3132,69 @@ const spawn = { } } }, + // focuser(x, y, radius = 30 + Math.ceil(Math.random() * 10)) { + // radius = Math.ceil(radius * 0.7); + // mobs.spawn(x, y, 4, radius, "rgb(0,0,255)"); + // let me = mob[mob.length - 1]; + // Matter.Body.setDensity(me, 0.003); //extra dense //normal is 0.001 + // me.restitution = 0; + // me.laserPos = me.position; //required for laserTracking + // me.repulsionRange = 1200000; //squared + // me.accelMag = 0.00009 * simulation.accelScale; + // me.frictionStatic = 0; + // me.friction = 0; + // me.onDamage = function () { + // this.laserPos = this.position; + // }; + // spawn.shield(me, x, y); + // me.do = function () { + // this.seePlayerByLookingAt(); + // this.checkStatus(); + // this.attraction(); + // const dist2 = this.distanceToPlayer2(); + // //laser Tracking + // if (this.seePlayer.yes && dist2 < 4000000) { + // const rangeWidth = 2000; //this is sqrt of 4000000 from above if() + // //targeting laser will slowly move from the mob to the player's position + // this.laserPos = Vector.add(this.laserPos, Vector.mult(Vector.sub(player.position, this.laserPos), 0.1)); + // let targetDist = Vector.magnitude(Vector.sub(this.laserPos, m.pos)); + // const r = 12; + // ctx.beginPath(); + // ctx.moveTo(this.position.x, this.position.y); + // if (targetDist < r + 16) { + // targetDist = r + 10; + // //charge at player + // const forceMag = this.accelMag * 40 * this.mass; + // const angle = Math.atan2(this.seePlayer.position.y - this.position.y, this.seePlayer.position.x - this.position.x); + // this.force.x += forceMag * Math.cos(angle); + // this.force.y += forceMag * Math.sin(angle); + // } + // // else { + // //high friction if can't lock onto player + // // Matter.Body.setVelocity(this, { + // // x: this.velocity.x * 0.98, + // // y: this.velocity.y * 0.98 + // // }); + // // } + // if (dist2 > 80000) { + // const laserWidth = 0.002; + // let laserOffR = Vector.rotateAbout(this.laserPos, (targetDist - r) * laserWidth, this.position); + // let sub = Vector.normalise(Vector.sub(laserOffR, this.position)); + // laserOffR = Vector.add(laserOffR, Vector.mult(sub, rangeWidth)); + // ctx.lineTo(laserOffR.x, laserOffR.y); + + // let laserOffL = Vector.rotateAbout(this.laserPos, (targetDist - r) * -laserWidth, this.position); + // sub = Vector.normalise(Vector.sub(laserOffL, this.position)); + // laserOffL = Vector.add(laserOffL, Vector.mult(sub, rangeWidth)); + // ctx.lineTo(laserOffL.x, laserOffL.y); + // ctx.fillStyle = `rgba(0,0,255,${Math.max(0, 0.3 * r / targetDist)})` + // ctx.fill(); + // } + // } else { + // this.laserPos = this.position; + // } + // } + // }, flutter(x, y, radius = 20 + 6 * Math.random()) { mobs.spawn(x, y, 7, radius, '#16576b'); let me = mob[mob.length - 1]; diff --git a/todo.txt b/todo.txt index 44a3054..4f149f2 100644 --- a/todo.txt +++ b/todo.txt @@ -1,24 +1,6 @@ ******************************************************** NEXT PATCH ************************************************** -reworked m.switchWorlds() (used in many-worlds and similar effects) - no longer has extra bot build up - effects that carry over into next world: - your total tech count - effects of non-removeable tech, like determinism -mass production research ramps up by 5->4 each time -bot fabrications cost ramp is increased to (+1 per 4)-->(+1 per 3) -lowered minimum threshold for making small heals from over healing to 13->20 health -snakeBoss invulnerable phase is 5->4 seconds long - -time dilation disables level based lasers -adjusted laser sensor paths on substructure level - -move splash screen buttons to bottom right -added a start button -details menus in splash screen now have individual widths instead of sharing with each other - -bugs - non-renewables change color for ammo power ups on current level +reworked focuser mobs to fire blue energy draining laser instead of charging player ******************************************************** BUGS ******************************************************** @@ -58,18 +40,18 @@ player can become crouched while not touching the ground if they exit the ground *********************************************************** TODO ***************************************************** -animate adding new tech or guns or field to the text menu - css transitions or trigger an animation? - bold for 3-5 seconds - is bold going to move other text up and down? - dark opacity 1 font - -new level - something with movers - - -rework focuser mobs to fire blue laser instead of charging player - like in classic 7-1-2017 - this makes more sense that a bean is focusing +new level - something with movers, rubber band blocks +button/switch input ideas from Cocoon game + pick up blocks that have a rubber band attached to a sliding switch + as player moves the vector direction of the rubber band will move the slider left or right + use this to open doors, move larger blocks, ... + switches that toggle left, right when player presses input.field while standing nearby + replace laser off on switch? + platform that rises up when player presses input.field while standing + How to instruct player to use field on these? + color with field #0ff + draw field effect + make it still functional without the field button !!conformal - similar rules for small and big scales linked to holographic principle @@ -81,47 +63,14 @@ rework focuser mobs to fire blue laser instead of charging player only after wormhole eats a block fire? or just increase plasma length after eating block? - -new level element - motion trigger for laser -new level heist - above - a building with rooms and doors like office/warehouse - below - long indoor tunnels like sewers - dark colors - narrow branching paths - elements - motion triggered lasers - doors opened by buttons - button that opens 1 door, but closes another when down - make the button down state easier, have extra power ups - - make a text orb for JUNK text to make JUNK more clear -extended vertical flip to edge cases: - !!stored circular graphics simulation.drawList.push - procedural animation https://www.youtube.com/watch?v=qlfh_rv6khY -not implemented random constraint ideas________________________ - mob death spawns something - mob bullets - bosses heals nearby mobs - ammo power ups give 0.7x ammo - 2x research costs - mobs slowly regen health - exit door takes 10x time to open, - and while door is opening (ghosters, suckers) attack? - can't have more then 15 bullets - how to code? - remove 2 random tech and return them next level - tech: ice-VII - 1.5x duration for ice-IX - tech: - freezing grenades/explosions - tech: - when you get a bot, get a second bot - tech: - after killing a Boss heal to full gain 3x damage for the rest of the level @@ -159,12 +108,6 @@ tech: atomic pile - lose 1 health if you are above the maximum energy do damage? plasma torch tech? -figure out how to put instructions for controls in background on initial level - mouse smooth makes the text position jitter when it moves sub pixels - hide the jitter with artificial jitter to make it seem intentional - make it look like the instructions are on a fuzzy TV screen - when player presses move buttons highlight the box/letter for those buttons - make player mass an adjustable var in the skin does this mess with jump height or air control? increase mass and movement speed at the same time @@ -174,10 +117,6 @@ increase mass and movement speed at the same time possible player.mass bad interactions grapple -rework energy and health HUD - make both diegetic? - how? not sure there is a good way to do this... - tech - after a power up is duplicated update text to random effect after choosing tech, or after each trigger, or on first display of tech pick 1 effect at random @@ -185,7 +124,7 @@ tech - after a power up is duplicated summon JUNK bots for 10 seconds 2x current energy gain 1.01x damage permanently - cool name: + cool name: after picking up heals gain ____ 0.1x damage taken for 12s @@ -201,43 +140,9 @@ tech - getting caught in an explosion gives you _____ damage for 10 seconds? heals -tech - limit total number of tech to like 10? - -tech - destroying blocks gives _____ - -removeJunkTechFromPool doesn't seem to remove the correct amount - -wormholes that end inside wall check to see if the space before the wall is safe and end there instead - can use laser code - -tech: - (1 + 0.01)x for each tech, gun, field you've picked up - scales with born rule, duplication, remove tech - explosions have a chance to spawn spores infinite feedback loop with spores that explode? -make sure healing isn't effected by simulation.healScale - instead heal orb size should be scaled - but the ratio between size and heal shouldn't be effected - -boss - tracks the position, velocity, angle of power ups, blocks, and bullets it fires - reactor only? - will rewind time - after damage threshold? - does it track player bullets? - -button/switch input ideas from Cocoon game - pick up blocks that have a rubber band attached to a sliding switch - as player moves the vector direction of the rubber band will move the slider left or right - use this to open doors, move larger blocks, ... - switches that toggle left, right when player presses input.field while standing nearby - replace laser off on switch? - platform that rises up when player presses input.field while standing - How to instruct player to use field on these? - color with field #0ff - draw field effect - make it still functional without the field button - tech - getting a new gun also gives you 2 random tech for that gun or a field? can these guntech tech be converted into a player choice?