From 6c73043c9f0dc2ba210c587c2ac09ea39b108679 Mon Sep 17 00:00:00 2001 From: landgreen Date: Mon, 6 Apr 2020 07:12:00 -0700 Subject: [PATCH] added timeSKipBoss to levels --- js/bullets.js | 42 +++++++++++++++------------ js/game.js | 65 ++++++++++++++++++----------------------- js/index.js | 18 ++++-------- js/level.js | 7 +++-- js/mobs.js | 8 ++---- js/player.js | 2 +- js/spawn.js | 26 ++++++++++------- todo.txt | 80 +++++++++++++-------------------------------------- 8 files changed, 100 insertions(+), 148 deletions(-) diff --git a/js/bullets.js b/js/bullets.js index 1928669..f2a2d0c 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -334,25 +334,6 @@ const b = { b.modNailBotCount = 0; } }, - { - name: "ablative drones", - description: "rebuild your broken parts as drones
chance to occur after being harmed", - maxCount: 1, - count: 0, - allowed() { - return true - }, - requires: "", - effect() { - b.isModDroneOnDamage = true; - for (let i = 0; i < 4; i++) { - b.drone() //spawn drone - } - }, - remove() { - b.isModDroneOnDamage = false; - } - }, { name: "ablative mines", description: "rebuild your broken parts as a mine
chance to occur after being harmed", @@ -376,6 +357,25 @@ const b = { b.isModMineOnDamage = false; } }, + { + name: "ablative drones", + description: "rebuild your broken parts as drones
chance to occur after being harmed", + maxCount: 1, + count: 0, + allowed() { + return true + }, + requires: "", + effect() { + b.isModDroneOnDamage = true; + for (let i = 0; i < 4; i++) { + b.drone() //spawn drone + } + }, + remove() { + b.isModDroneOnDamage = false; + } + }, { name: "Lorentzian topology", description: "your bullets last +33% longer", @@ -591,6 +591,10 @@ const b = { requires: "", effect() { b.isModEntanglement = true + setTimeout(function () { + game.boldActiveGunHUD(); + }, 10); + }, remove() { b.isModEntanglement = false; diff --git a/js/game.js b/js/game.js index f14563d..91b7a7c 100644 --- a/js/game.js +++ b/js/game.js @@ -257,21 +257,6 @@ const game = { game.boldActiveGunHUD(); // mech.drop(); }, - // tips = [ - // "You can throw blocks at dangerous speeds by holding the right mouse or spacebar.", - // "You can use your field to block damage. (right mouse or spacebar)", - // "Explosive weapons, like the grenade are good at clearing groups.", - // "Larger and faster bullets do more damage.", - // "You take more damage from colliding with larger baddies", - // "Holding large blocks slows down the player.", - // "holding blocks prevents the field energy from regenerating.", - // `There are ${mech.fieldUpgrades.length-1} possible field upgrades.`, - // `There are ${b.guns.length} different guns.`, - // "You keep field upgrades after you die.", - // "Unique level bosses always drop a field upgrade if you don't have one.", - // "You jump higher if you hold down the jump button.", - // "Crouching while firing makes bullets go faster, but slows the rate of fire.", - // ] keyPress() { //runs on key down event if (keys[189]) { // - key @@ -393,16 +378,6 @@ const game = { game.zoomScale = zoomScale game.zoom = canvas.height / zoomScale; //sets starting zoom scale }, - noCameraScroll() { - // makes the camera not scroll after changing locations - mech.pos.x = player.position.x; - mech.pos.y = playerBody.position.y - mech.yOff; - const scale = 0.8; - 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.transX) * 1; - mech.transY += (mech.transSmoothY - mech.transY) * 1; - }, zoomTransition(newZoomScale, step = 2) { if (game.isAutoZoom) { const isBigger = (newZoomScale - game.zoomScale > 0) ? true : false; @@ -431,18 +406,6 @@ const game = { } } }, - camera() { - ctx.save(); - ctx.translate(canvas.width2, canvas.height2); //center - ctx.scale(game.zoom, game.zoom); //zoom in once centered - ctx.translate(-canvas.width2 + mech.transX, -canvas.height2 + mech.transY); //translate - //calculate in game mouse position by undoing the zoom and translations - game.mouseInGame.x = (game.mouse.x - canvas.width2) / game.zoom + canvas.width2 - mech.transX; - game.mouseInGame.y = (game.mouse.y - canvas.height2) / game.zoom + canvas.height2 - mech.transY; - }, - restoreCamera() { - ctx.restore(); - }, zoomInFactor: 0, startZoomIn(time = 180) { game.zoom = 0; @@ -459,6 +422,28 @@ const game = { } } }, + noCameraScroll() { + // makes the camera not scroll after changing locations + mech.pos.x = player.position.x; + mech.pos.y = playerBody.position.y - mech.yOff; + const scale = 0.8; + 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.transX) * 1; + mech.transY += (mech.transSmoothY - mech.transY) * 1; + }, + camera() { + ctx.save(); + ctx.translate(canvas.width2, canvas.height2); //center + ctx.scale(game.zoom, game.zoom); //zoom in once centered + ctx.translate(-canvas.width2 + mech.transX, -canvas.height2 + mech.transY); //translate + //calculate in game mouse position by undoing the zoom and translations + game.mouseInGame.x = (game.mouse.x - canvas.width2) / game.zoom + canvas.width2 - mech.transX; + game.mouseInGame.y = (game.mouse.y - canvas.height2) / game.zoom + canvas.height2 - mech.transY; + }, + restoreCamera() { + ctx.restore(); + }, wipe() { ctx.clearRect(0, 0, canvas.width, canvas.height); }, @@ -711,6 +696,12 @@ const game = { x: level.enter.x + 50, y: level.enter.y - 20 }); + // Matter.Body.setPosition(player, { + // x: player.position.x, + // y: -7000 + // }); + // game.noCameraScroll() + mech.energy = 0; if (game.difficultyMode === 2) mech.damage(0.3); if (game.difficultyMode === 1) mech.damage(0.1); diff --git a/js/index.js b/js/index.js index 2ae60fa..419e672 100644 --- a/js/index.js +++ b/js/index.js @@ -72,7 +72,6 @@ const build = { } }, pauseGrid() { - // let text = `
` let text = `
PAUSED               press P to resume @@ -84,13 +83,8 @@ const build = {

health: ${(mech.health*100).toFixed(0)}%   energy: ${(mech.energy*100).toFixed(0)}%   mass: ${player.mass.toFixed(1)}
position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)})   velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)}) -
- - `; - //
- // ${game.SVGleftMouse} fire gun - // ${game.SVGrightMouse} use field - //
+ `; + let countGuns = 0 let countMods = 0 for (let i = 0, len = b.guns.length; i < len; i++) { @@ -212,10 +206,10 @@ const build = { - - share - - + + share + +
starting level:
diff --git a/js/level.js b/js/level.js index 7c2f692..6d930b4 100644 --- a/js/level.js +++ b/js/level.js @@ -147,7 +147,7 @@ const level = { spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump // spawn.laserBoss(2900, -500) - spawn.springer(3200, -500) + spawn.beamer(1200, -500) // spawn.timeSkipBoss(2900, -500) // spawn.randomMob(3200, -500) @@ -701,7 +701,7 @@ const level = { //spawn.mapRect(-700, 0, 6250, 100); //ground spawn.mapRect(3400, 0, 2150, 100); //ground - spawn.mapRect(-700, -2000, 2100, 50); //Top left ledge + spawn.mapRect(-700, -2000, 2110, 50); //Top left ledge spawn.bodyRect(1300, -2125, 50, 125, 0.8); spawn.bodyRect(1307, -2225, 50, 100, 0.8); spawn.mapRect(-700, -2350, 50, 400); //far left starting left wall @@ -715,6 +715,7 @@ const level = { spawn.mapRect(1850, -2000, 650, 50); spawn.bodyRect(200, -2150, 200, 220, 0.8); spawn.mapRect(700, -2275, 600, 50); + spawn.mapRect(1000, -1350, 410, 50); spawn.bodyRect(1050, -2350, 30, 30, 0.8); // spawn.boost(1800, -1000, 1200); spawn.bodyRect(1625, -1100, 100, 75); @@ -938,7 +939,7 @@ const level = { spawn.randomBoss(4000, -350, 0.6); spawn.randomBoss(2750, -550, 0.1); if (game.difficulty > 2) { - if (Math.random() < 0.3) { // tether ball + if (Math.random() < 0.1) { // tether ball spawn.tetherBoss(4250, 0) cons[cons.length] = Constraint.create({ pointA: { diff --git a/js/mobs.js b/js/mobs.js index ee16ba8..0123e3d 100644 --- a/js/mobs.js +++ b/js/mobs.js @@ -7,11 +7,6 @@ const mobs = { while (i--) { if (mob[i].alive) { mob[i].do(); - // let j = mob[i].status.length; - // while (j--) { - // mob[i].status[j].effect(); - // if (mob[i].status[j].endCycle > game.cycle) mob[i].status.splice(j, 0); - // } } else { mob[i].replace(i); //removing mob and replace with body, this is done here to avoid an array index bug with drawing I think } @@ -49,6 +44,8 @@ const mobs = { } }, statusSlow(who, cycles = 60) { + console.log('slow') + if (!who.shield && !who.isShielded) { //remove other "slow" effects on this mob let i = who.status.length @@ -788,7 +785,6 @@ const mobs = { if (this.seePlayer.recall && this.cd < game.cycle) { const dist = Vector.sub(this.seePlayer.position, this.position); const distMag = Vector.magnitude(dist); - console.log(this.seePlayer.recall) if (distMag < 400) { this.cd = game.cycle + this.delay; ctx.beginPath(); diff --git a/js/player.js b/js/player.js index b129cf4..32f1068 100644 --- a/js/player.js +++ b/js/player.js @@ -564,7 +564,7 @@ const mech = { // freeze game and display a full screen red color if (dmg > 0.05) { - if (dmg > 0.07 && mech.holdingMassScale > 0.2) mech.drop(); //drop block if holding + if (dmg > 0.15 * mech.holdingMassScale) mech.drop(); //drop block if holding game.fpsCap = 4 //40 - Math.min(25, 100 * dmg) game.fpsInterval = 1000 / game.fpsCap; } else { diff --git a/js/spawn.js b/js/spawn.js index d5a3af9..68bb254 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -80,7 +80,7 @@ const spawn = { }, randomLevelBoss(x, y) { // suckerBoss, laserBoss, tetherBoss, snakeBoss all need a particular level to work so they are not included - const options = ["shooterBoss", "cellBossCulture", "bomberBoss"] + const options = ["shooterBoss", "cellBossCulture", "bomberBoss", "timeSkipBoss"] spawn[options[Math.floor(Math.random() * options.length)]](x, y) }, //mob templates ********************************************************************************************* @@ -638,34 +638,40 @@ const spawn = { } } }, - timeSkipBoss(x, y, radius = 80) { + timeSkipBoss(x, y, radius = 60) { mobs.spawn(x, y, 6, radius, '#000'); let me = mob[mob.length - 1]; // me.stroke = "transparent"; //used for drawSneaker me.timeSkipLastCycle = 0 - me.eventHorizon = 1300; //required for black hole - me.seeAtDistance2 = (me.eventHorizon + 1000) * (me.eventHorizon + 1000); //vision limit is event horizon - me.accelMag = 0.00013 * game.accelScale; + me.eventHorizon = 1500; //required for black hole + me.seeAtDistance2 = (me.eventHorizon + 2000) * (me.eventHorizon + 2000); //vision limit is event horizon + 2000 + me.accelMag = 0.00022 * game.accelScale; // me.frictionAir = 0.005; // me.memory = 1600; - Matter.Body.setDensity(me, 0.018); //extra dense //normal is 0.001 //makes effective life much larger + Matter.Body.setDensity(me, 0.02); //extra dense //normal is 0.001 //makes effective life much larger me.onDeath = function () { //applying forces to player doesn't seem to work inside this method, not sure why powerUps.spawnBossPowerUp(this.position.x, this.position.y) }; me.do = function () { //keep it slow, to stop issues from explosion knock backs + if (this.speed > 2) { + Matter.Body.setVelocity(this, { + x: this.velocity.x * 0.99, + y: this.velocity.y * 0.99 + }); + } this.seePlayerCheck(); this.checkStatus(); this.attraction() if (!game.isTimeSkipping) { - const compress = 3 + const compress = 2 if (this.timeSkipLastCycle < game.cycle - compress && Vector.magnitude(Vector.sub(this.position, player.position)) < this.eventHorizon) { this.timeSkipLastCycle = game.cycle game.timeSkip(compress) - this.fill = `rgba(0,0,0,${0.1+0.1*Math.random()})` + this.fill = `rgba(0,0,0,${0.1+0.4*Math.random()})` this.stroke = "#000" this.isShielded = false; this.dropPowerUp = true; @@ -673,7 +679,7 @@ const spawn = { ctx.beginPath(); ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI); - ctx.fillStyle = `rgba(255,255,255,${mech.energy*0.5})`; + ctx.fillStyle = "#fff"; ctx.globalCompositeOperation = "destination-in"; //in or atop ctx.fill(); ctx.globalCompositeOperation = "source-over"; @@ -703,7 +709,7 @@ const spawn = { this.collisionFilter.mask = cat.player | cat.map | cat.body | cat.mob; //can't touch bullets ctx.beginPath(); ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI); - ctx.fillStyle = `rgba(0,0,0,${0.1*Math.random()})`; + ctx.fillStyle = `rgba(0,0,0,${0.05*Math.random()})`; ctx.fill(); } } diff --git a/todo.txt b/todo.txt index f23f278..3c4040d 100644 --- a/todo.txt +++ b/todo.txt @@ -5,7 +5,24 @@ boss mob - just a faster and larger version of a springer mob always shielded consider combining with time skipper field? -pulse and time dilation only ones left with no dedicated mod +pulse and time dilation only upgrades left with no dedicated mod + +mob - time skipper: sends a pulse wave out that will cause time to jump forward 1 second. + +mob stabber - extends one vector like the shooter, but quickly in order to stab + +mob sniper - targeting laser, then a high speed, no gravity bullet + +mod - nails do poison damage + +mod - increase laser bot range, and reduce energy drain + +mod - mines become a turret that fires nails + it could float to the mouse location on fire + +mod - blocks stun mobs + +settings - custom keys binding lore - a robot (the player) gains self awareness each mod/gun/field is a new tech @@ -16,46 +33,6 @@ lore - a robot (the player) gains self awareness you get immortality and Infinity damage the next level is the final level when you die with Quantum Immortality there is a chance of lore text - make a global variable that goes up by one every time you play - show text at start, loading simulation #... - -mod - status effects last 1 second longer - cryonics : a mod that increases the freezing time of mobs. - wait until you have more status effects written - -mob Boss - time skipper: sends a pulse wave out that will cause time to jump forward 1 second. - what about a series of short time skips forward 10 cycles at a time - -MOB stabber - extends one vector like the shooter, but quickly in order to stab - -work on burn status effect - graphics don't look right - how is it different from the chemical dot - -mod - nails do poison damage - -mod - increase laser bot range, and reduce energy drain - -mod - mines become a turret that fires nails - it could float to the mouse location on fire - -dash - mod when pressing left or right on the ground, teleport to the right until you find an obstruction - do repeated horizontal zone queries until they hit map or block - up to a max range of like 10 player widths - this didn't work as a field, but maybe as a gun? - -mod - blocks stun mobs - -mod or field - turn blocks into spores or drones - -mod - robot that attack nearby mobs, and delivers a stun status effect - use laser bot code for the attack - large and 5 sided? - -settings - auto aim at nearest mob -settings - custom keys binding - -mod - energy recharges faster when not moving atmosphere levels: change the pace, give the user a rest between combat low or no combat, but more graphics @@ -71,11 +48,9 @@ atmosphere levels: change the pace, give the user a rest between combat in the final level you see your self at the starting level, with the wires you shoot your self to wake up? -MOB sniper - targeting laser, then a high speed, no gravity bullet - css transition for pause menu -mod: do extra damage based on your speed +mod - do extra damage based on your speed do more damage when not moving? take less damage when not moving? @@ -88,15 +63,6 @@ weekly random challenge where everyone playing each week gets the same random se The randomness would be determined by the date so it would sync everyone. power ups still drop, but the drops are determined by a preset list that changes each week. -mod: do something at the end of each level - heal to full - should still be effected by the heal reduction at higher difficulty - give ammo to current gun - give goals/quests for each level - how to track goals? - take no damage - don't shoot - gun: Spirit Bomb (singularity) use charge up like rail gun electricity graphics like plasma torch @@ -105,7 +71,7 @@ gun: Spirit Bomb (singularity) uses energy hold above the player's head -Boss levels +small Boss levels sensor that locks you in after you enter the boss room boss that eats other mobs and gains stats from them chance to spawn on any level (past level 5) @@ -116,12 +82,6 @@ make power ups keep moving to player if the pickup field is turned off before th not sure how to do this without adding a constant check animate new level 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 to the teleportation - this can apply to blocks mobs, and power ups as well give mobs more animal-like behaviors like rain world