textlog overlap

This commit is contained in:
landgreen
2019-11-07 06:05:42 -08:00
parent c835488f63
commit 1a5366fa9c
5 changed files with 24 additions and 7 deletions

View File

@@ -162,6 +162,7 @@ const b = {
} else { } else {
mech.fireCDcycle = mech.cycle + 30; //cooldown mech.fireCDcycle = mech.cycle + 30; //cooldown
// game.makeTextLog("<div style='font-size:140%;'>NO AMMO</div><span class = 'box'>E</span> / <span class = 'box'>Q</span>", 200); // game.makeTextLog("<div style='font-size:140%;'>NO AMMO</div><span class = 'box'>E</span> / <span class = 'box'>Q</span>", 200);
game.replaceTextLog = true;
game.makeTextLog("<div style='font-size:140%;'>NO AMMO</div> <p style='font-size:90%;'><strong>Q</strong>, <strong>E</strong>, and <strong>mouse wheel</strong> change weapons</p>", 200); game.makeTextLog("<div style='font-size:140%;'>NO AMMO</div> <p style='font-size:90%;'><strong>Q</strong>, <strong>E</strong>, and <strong>mouse wheel</strong> change weapons</p>", 200);
} }
if (mech.isHolding) { if (mech.isHolding) {
@@ -1163,7 +1164,7 @@ const b = {
have: false, have: false,
fire() { fire() {
const THRUST = 0.0015 const THRUST = 0.0015
const dir = mech.angle + (Math.random() - 0.5) * 0.7; const dir = mech.angle + 0.2 * (Math.random() - 0.5);
const me = bullet.length; const me = bullet.length;
const RADIUS = (4 + 4 * Math.random()) * b.modBulletSize const RADIUS = (4 + 4 * Math.random()) * b.modBulletSize
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), RADIUS, { bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), RADIUS, {
@@ -1245,7 +1246,7 @@ const b = {
} }
} }
}) })
b.fireProps(mech.crouch ? 19 : 15, mech.crouch ? 30 : 1, dir, me); //cd , speed b.fireProps(mech.crouch ? 19 : 15, mech.crouch ? 35 : 1, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices); b.drawOneBullet(bullet[me].vertices);
} }
}, },

View File

@@ -172,14 +172,18 @@ const game = {
} }
document.getElementById("mods").innerHTML = text document.getElementById("mods").innerHTML = text
}, },
replaceTextLog: true,
makeTextLog(text, time = 180) { makeTextLog(text, time = 180) {
document.getElementById("text-log").innerHTML = text; if (game.replaceTextLog) {
document.getElementById("text-log").style.opacity = 1; document.getElementById("text-log").innerHTML = text;
game.lastLogTime = mech.cycle + time; document.getElementById("text-log").style.opacity = 1;
game.lastLogTime = mech.cycle + time;
}
}, },
textLog() { textLog() {
if (game.lastLogTime && game.lastLogTime < mech.cycle) { if (game.lastLogTime && game.lastLogTime < mech.cycle) {
game.lastLogTime = 0; game.lastLogTime = 0;
game.replaceTextLog = true
// document.getElementById("text-log").innerHTML = " "; // document.getElementById("text-log").innerHTML = " ";
document.getElementById("text-log").style.opacity = 0; document.getElementById("text-log").style.opacity = 0;
} }
@@ -269,6 +273,7 @@ const game = {
requestAnimationFrame(cycle); requestAnimationFrame(cycle);
} else { } else {
game.paused = true; game.paused = true;
game.replaceTextLog = true;
game.makeTextLog("<h1>PAUSED</h1>", 1); game.makeTextLog("<h1>PAUSED</h1>", 1);
// let text = "<h1>PAUSED</h1><br><div style='font-size: 85%;'>" // let text = "<h1>PAUSED</h1><br><div style='font-size: 85%;'>"
// //output current mod, field, and gun info when paused // //output current mod, field, and gun info when paused

View File

@@ -34,10 +34,12 @@ field power up effects
field allows player to hold and throw living mobs field allows player to hold and throw living mobs
mod power ups ideas mod power ups ideas
double jump
bullet on mob damage effects bullet on mob damage effects
add to the array mob.do new mob behaviors add to the array mob.do new mob behaviors
add a damage over time add a damage over time
add a freeze add a freeze
give mobs more animal-like behaviors give mobs more animal-like behaviors
like rainworld like rainworld
give mobs something to do when they don't see player give mobs something to do when they don't see player

View File

@@ -438,6 +438,7 @@ const mech = {
randomizeGuns() randomizeGuns()
randomizeField() randomizeField()
randomizeHealth() randomizeHealth()
game.replaceTextLog = true;
game.makeTextLog(`probability amplitude will synchronize in ${6-i} seconds`, 1000); game.makeTextLog(`probability amplitude will synchronize in ${6-i} seconds`, 1000);
game.wipe = function () { //set wipe to have trails game.wipe = function () { //set wipe to have trails
ctx.fillStyle = `rgba(255,255,255,${(i+1)*(i+1)*0.003})`; ctx.fillStyle = `rgba(255,255,255,${(i+1)*(i+1)*0.003})`;
@@ -450,6 +451,7 @@ const mech = {
game.wipe = function () { //set wipe to normal game.wipe = function () { //set wipe to normal
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
} }
game.replaceTextLog = true;
game.makeTextLog("your quantum probability has stabilized", 1000); game.makeTextLog("your quantum probability has stabilized", 1000);
document.title = "n-gon: L" + (game.levelsCleared) + " " + level.levels[level.onLevel]; document.title = "n-gon: L" + (game.levelsCleared) + " " + level.levels[level.onLevel];
}, 8000); }, 8000);
@@ -947,7 +949,9 @@ const mech = {
}, },
hold() {}, hold() {},
fieldText() { fieldText() {
game.replaceTextLog = true;
game.makeTextLog(`<div class="circle field "></div> &nbsp; <strong style='font-size:30px;'>${mech.fieldUpgrades[mech.fieldMode].name}</strong><br><span class='faded'>(right click or space bar)</span><br><br>${mech.fieldUpgrades[mech.fieldMode].description}`, 1000); game.makeTextLog(`<div class="circle field "></div> &nbsp; <strong style='font-size:30px;'>${mech.fieldUpgrades[mech.fieldMode].name}</strong><br><span class='faded'>(right click or space bar)</span><br><br>${mech.fieldUpgrades[mech.fieldMode].description}`, 1000);
game.replaceTextLog = false;
document.getElementById("field").innerHTML = mech.fieldUpgrades[mech.fieldMode].name //add field document.getElementById("field").innerHTML = mech.fieldUpgrades[mech.fieldMode].name //add field
}, },
fieldUpgrades: [{ fieldUpgrades: [{
@@ -956,6 +960,7 @@ const mech = {
effect: () => { effect: () => {
mech.fieldMode = 0; mech.fieldMode = 0;
mech.fieldText(); mech.fieldText();
game.replaceTextLog = true; //allow text over write
// game.makeTextLog("<strong style='font-size:30px;'></strong><br> <span class='faded'>(right click or space bar)</span><p></p>", 1200); // game.makeTextLog("<strong style='font-size:30px;'></strong><br> <span class='faded'>(right click or space bar)</span><p></p>", 1200);
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.hold = function () { mech.hold = function () {

View File

@@ -11,7 +11,7 @@ const powerUps = {
let heal = (this.size / 40) ** 2 let heal = (this.size / 40) ** 2
heal = Math.min(1 - mech.health, heal) heal = Math.min(1 - mech.health, heal)
mech.addHealth(heal); mech.addHealth(heal);
if (!game.lastLogTime && heal > 0) game.makeTextLog("<span style='font-size:115%;'> <strong class='color-h' style = 'letter-spacing: 2px;'>heal</strong> " + (heal * 100).toFixed(0) + "%</span>", 300) if (heal > 0) game.makeTextLog("<span style='font-size:115%;'> <strong class='color-h' style = 'letter-spacing: 2px;'>heal</strong> " + (heal * 100).toFixed(0) + "%</span>", 300)
} }
}, },
ammo: { ammo: {
@@ -47,7 +47,7 @@ const powerUps = {
const ammo = Math.ceil((target.ammoPack * (0.5 + 0.08 * Math.random())) / b.dmgScale); const ammo = Math.ceil((target.ammoPack * (0.5 + 0.08 * Math.random())) / b.dmgScale);
target.ammo += ammo; target.ammo += ammo;
game.updateGunHUD(); game.updateGunHUD();
if (!game.lastLogTime) game.makeTextLog("<span style='font-size:110%;'>+" + ammo + " ammo for " + target.name + "</span>", 300); game.makeTextLog("<span style='font-size:110%;'>+" + ammo + " ammo for " + target.name + "</span>", 300);
} }
} }
}, },
@@ -92,7 +92,9 @@ const powerUps = {
if (options.length > 0) { if (options.length > 0) {
let newMod = options[Math.floor(Math.random() * options.length)] let newMod = options[Math.floor(Math.random() * options.length)]
b.giveMod(newMod) b.giveMod(newMod)
game.replaceTextLog = true;
game.makeTextLog(`<div class="circle mod"></div> &nbsp; <strong style='font-size:30px;'>${b.mods[newMod].name}</strong><br><br> ${b.mods[newMod].description}`, 1000); game.makeTextLog(`<div class="circle mod"></div> &nbsp; <strong style='font-size:30px;'>${b.mods[newMod].name}</strong><br><br> ${b.mods[newMod].description}`, 1000);
game.replaceTextLog = false;
} }
} }
}, },
@@ -113,6 +115,7 @@ const powerUps = {
} }
} }
//give player a gun they don't already have if possible //give player a gun they don't already have if possible
game.replaceTextLog = true;
if (options.length > 0) { if (options.length > 0) {
let newGun = options[Math.floor(Math.random() * options.length)]; let newGun = options[Math.floor(Math.random() * options.length)];
if (b.activeGun === null) b.activeGun = newGun //if no active gun switch to new gun if (b.activeGun === null) b.activeGun = newGun //if no active gun switch to new gun
@@ -129,6 +132,7 @@ const powerUps = {
game.updateGunHUD(); game.updateGunHUD();
game.makeTextLog("<span style='font-size:110%;'>+" + ammo + " ammo for " + b.guns[ammoTarget].name + "</span>", 300); game.makeTextLog("<span style='font-size:110%;'>+" + ammo + " ammo for " + b.guns[ammoTarget].name + "</span>", 300);
} }
game.replaceTextLog = false
} }
}, },
spawnRandomPowerUp(x, y) { //mostly used after mob dies spawnRandomPowerUp(x, y) { //mostly used after mob dies