added colors to custom grid select
added random laser boss positions
This commit is contained in:
18
js/index.js
18
js/index.js
@@ -68,7 +68,7 @@ const build = {
|
||||
for (let i = 0, len = b.inventory.length; i < len; i++) { //look for selection in inventory
|
||||
if (b.guns[b.inventory[i]].name === b.guns[index].name) { //if already clicked, remove gun
|
||||
isDeselect = true
|
||||
who.classList.remove("build-grid-selected");
|
||||
who.classList.remove("build-gun-selected");
|
||||
//remove gun
|
||||
b.inventory.splice(i, 1)
|
||||
b.guns[index].count = 0;
|
||||
@@ -79,24 +79,24 @@ const build = {
|
||||
}
|
||||
}
|
||||
if (!isDeselect) { //add gun
|
||||
who.classList.add("build-grid-selected");
|
||||
who.classList.add("build-gun-selected");
|
||||
b.giveGuns(index)
|
||||
}
|
||||
} else if (type === "field") {
|
||||
if (mech.fieldMode !== index) {
|
||||
document.getElementById("field-" + mech.fieldMode).classList.remove("build-grid-selected");
|
||||
document.getElementById("field-" + mech.fieldMode).classList.remove("build-field-selected");
|
||||
mech.setField(index)
|
||||
who.classList.add("build-grid-selected");
|
||||
who.classList.add("build-field-selected");
|
||||
}
|
||||
} else if (type === "mod") { //remove mod if you have too many
|
||||
if (b.mods[index].count < b.mods[index].maxCount) {
|
||||
if (!who.classList.contains("build-grid-selected")) who.classList.add("build-grid-selected");
|
||||
if (!who.classList.contains("build-mod-selected")) who.classList.add("build-mod-selected");
|
||||
b.giveMod(index)
|
||||
// if (b.mods[index].count > 1) who.innerHTML = `<div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[index].name} (${b.mods[index].count}x)</div> ${b.mods[index].description}`
|
||||
} else {
|
||||
b.removeMod(index);
|
||||
// who.innerHTML = `<div class="grid-title"><div class="circle-grid mod"></div> ${b.mods[index].name}</div> ${b.mods[index].description}`
|
||||
who.classList.remove("build-grid-selected");
|
||||
who.classList.remove("build-mod-selected");
|
||||
}
|
||||
}
|
||||
//update mod text //disable not allowed mods
|
||||
@@ -123,8 +123,8 @@ const build = {
|
||||
if (b.mods[i].count > 0) {
|
||||
b.removeMod(i)
|
||||
}
|
||||
if (modID.classList.contains("build-grid-selected")) {
|
||||
modID.classList.remove("build-grid-selected");
|
||||
if (modID.classList.contains("build-mod-selected")) {
|
||||
modID.classList.remove("build-mod-selected");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ const build = {
|
||||
b.setupAllMods();
|
||||
build.isCustomSelection = true;
|
||||
build.populateGrid();
|
||||
document.getElementById("field-0").classList.add("build-grid-selected");
|
||||
document.getElementById("field-0").classList.add("build-field-selected");
|
||||
document.getElementById("build-grid").style.display = "grid"
|
||||
},
|
||||
|
||||
|
||||
18
js/level.js
18
js/level.js
@@ -13,7 +13,7 @@ const level = {
|
||||
levelsCleared: 0,
|
||||
start() {
|
||||
if (level.levelsCleared === 0) {
|
||||
// level.difficultyIncrease(5)
|
||||
// level.difficultyIncrease(4)
|
||||
// b.giveGuns("laser")
|
||||
// mech.setField("negative mass field")
|
||||
// for (let i = 0; i < 9; i++) {
|
||||
@@ -448,6 +448,8 @@ const level = {
|
||||
spawn.mapRect(-500, -1900, 400, 50); //super high shade
|
||||
spawn.mapRect(0, -1900, 400, 50); //super high shade
|
||||
spawn.mapRect(-150, -1350, 200, 25); //super high shade
|
||||
spawn.bodyRect(140, -2100, 150, 200); //shield from laser
|
||||
|
||||
level.fillBG.push({
|
||||
x: -300,
|
||||
y: -1900,
|
||||
@@ -563,9 +565,17 @@ const level = {
|
||||
spawn.randomBoss(2700, -1600, 0.1);
|
||||
spawn.randomBoss(1600, -100, 0);
|
||||
spawn.randomBoss(5000, -3900, -0.3);
|
||||
// spawn.laserBoss(2750, -2600);
|
||||
if (game.difficulty > 3) spawn.laserBoss(3050, -2850);
|
||||
|
||||
if (game.difficulty > 3) {
|
||||
if (Math.random() < 0.25) {
|
||||
spawn.laserBoss(2900 + 300 * Math.random(), -2950 + 150 * Math.random());
|
||||
} else if (Math.random() < 0.33) {
|
||||
spawn.laserBoss(1800 + 250 * Math.random(), -2600 + 150 * Math.random());
|
||||
} else if (Math.random() < 0.5) {
|
||||
spawn.laserBoss(3500 + 250 * Math.random(), -2600 + 1000 * Math.random());
|
||||
} else {
|
||||
spawn.laserBoss(600 + 200 * Math.random(), -2150 + 250 * Math.random());
|
||||
}
|
||||
}
|
||||
},
|
||||
rooftops() {
|
||||
level.defaultZoom = 1700
|
||||
|
||||
@@ -130,7 +130,7 @@ const powerUps = {
|
||||
},
|
||||
mod: {
|
||||
name: "mod",
|
||||
color: "#a8f",
|
||||
color: "hsl(246,100%,77%)", //"#a8f",
|
||||
size() {
|
||||
return 42;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user