added rewards for level completion
This commit is contained in:
@@ -612,7 +612,6 @@ const game = {
|
|||||||
player.force.y += player.mass * game.g;
|
player.force.y += player.mass * game.g;
|
||||||
},
|
},
|
||||||
reset() { //run on first run, and each later run after you die
|
reset() { //run on first run, and each later run after you die
|
||||||
game.isCheating = false
|
|
||||||
b.removeAllGuns();
|
b.removeAllGuns();
|
||||||
mod.setupAllMods(); //sets mods to default values
|
mod.setupAllMods(); //sets mods to default values
|
||||||
b.setFireCD();
|
b.setFireCD();
|
||||||
@@ -668,6 +667,7 @@ const game = {
|
|||||||
document.getElementById("construct").style.display = 'none'
|
document.getElementById("construct").style.display = 'none'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
game.isCheating = false
|
||||||
},
|
},
|
||||||
firstRun: true,
|
firstRun: true,
|
||||||
splashReturn() {
|
splashReturn() {
|
||||||
|
|||||||
@@ -477,6 +477,7 @@ if (localSettings) {
|
|||||||
difficultyMode: '1',
|
difficultyMode: '1',
|
||||||
fpsCapDefault: 'max',
|
fpsCapDefault: 'max',
|
||||||
runCount: 0,
|
runCount: 0,
|
||||||
|
levelsClearedLastGame: 0
|
||||||
};
|
};
|
||||||
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||||
document.getElementById("community-maps").checked = localSettings.isCommunityMaps
|
document.getElementById("community-maps").checked = localSettings.isCommunityMaps
|
||||||
@@ -617,6 +618,7 @@ document.getElementById("community-maps").addEventListener("input", () => {
|
|||||||
document.getElementById("difficulty-select").addEventListener("input", () => {
|
document.getElementById("difficulty-select").addEventListener("input", () => {
|
||||||
game.difficultyMode = Number(document.getElementById("difficulty-select").value)
|
game.difficultyMode = Number(document.getElementById("difficulty-select").value)
|
||||||
localSettings.difficultyMode = game.difficultyMode
|
localSettings.difficultyMode = game.difficultyMode
|
||||||
|
localSettings.levelsClearedLastGame = 0 //after changing difficulty, reset run history
|
||||||
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,15 @@ const level = {
|
|||||||
// level.newLevel() //fan level
|
// level.newLevel() //fan level
|
||||||
// level.basement(); //fan level
|
// level.basement(); //fan level
|
||||||
// level.stronghold() //fan level
|
// level.stronghold() //fan level
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns
|
spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns
|
||||||
// spawn.pickList = ["focuser", "focuser"]
|
// spawn.pickList = ["focuser", "focuser"]
|
||||||
level[level.levels[level.onLevel]](); //picks the current map from the the levels array
|
level[level.levels[level.onLevel]](); //picks the current map from the the levels array
|
||||||
if (!game.isCheating) {
|
if (!game.isCheating) {
|
||||||
localSettings.runCount += level.levelsCleared //track the number of total runs locally
|
localSettings.runCount += level.levelsCleared //track the number of total runs locally
|
||||||
|
localSettings.levelsClearedLastGame = level.levelsCleared
|
||||||
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3166,7 +3169,7 @@ const level = {
|
|||||||
difficultyIncrease(num = 1) {
|
difficultyIncrease(num = 1) {
|
||||||
for (let i = 0; i < num; i++) {
|
for (let i = 0; i < num; i++) {
|
||||||
game.difficulty++
|
game.difficulty++
|
||||||
game.dmgScale += 0.35; //damage done by mobs increases each level
|
game.dmgScale += 0.37; //damage done by mobs increases each level
|
||||||
b.dmgScale *= 0.92; //damage done by player decreases each level
|
b.dmgScale *= 0.92; //damage done by player decreases each level
|
||||||
if (game.accelScale < 5) game.accelScale *= 1.027 //mob acceleration increases each level
|
if (game.accelScale < 5) game.accelScale *= 1.027 //mob acceleration increases each level
|
||||||
if (game.lookFreqScale > 0.2) game.lookFreqScale *= 0.975 //mob cycles between looks decreases each level
|
if (game.lookFreqScale > 0.2) game.lookFreqScale *= 0.975 //mob cycles between looks decreases each level
|
||||||
@@ -3177,7 +3180,7 @@ const level = {
|
|||||||
difficultyDecrease(num = 1) { //used in easy mode for game.reset()
|
difficultyDecrease(num = 1) { //used in easy mode for game.reset()
|
||||||
for (let i = 0; i < num; i++) {
|
for (let i = 0; i < num; i++) {
|
||||||
game.difficulty--
|
game.difficulty--
|
||||||
game.dmgScale -= 0.35; //damage done by mobs increases each level
|
game.dmgScale -= 0.37; //damage done by mobs increases each level
|
||||||
if (game.dmgScale < 0.1) game.dmgScale = 0.1;
|
if (game.dmgScale < 0.1) game.dmgScale = 0.1;
|
||||||
b.dmgScale /= 0.92; //damage done by player decreases each level
|
b.dmgScale /= 0.92; //damage done by player decreases each level
|
||||||
if (game.accelScale > 0.2) game.accelScale /= 1.027 //mob acceleration increases each level
|
if (game.accelScale > 0.2) game.accelScale /= 1.027 //mob acceleration increases each level
|
||||||
|
|||||||
@@ -1029,7 +1029,7 @@ const mod = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Bayesian statistics",
|
name: "Bayesian statistics",
|
||||||
description: "<strong>25%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>collision</strong>, <strong>eject</strong> one of your <strong class='color-m'>mods</strong>",
|
description: "<strong>20%</strong> chance to <strong>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>collision</strong>, <strong>eject</strong> one of your <strong class='color-m'>mods</strong>",
|
||||||
maxCount: 1,
|
maxCount: 1,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ const mech = {
|
|||||||
light: 100,
|
light: 100,
|
||||||
},
|
},
|
||||||
setFillColors() {
|
setFillColors() {
|
||||||
console.log(mech.color)
|
// console.log(mech.color)
|
||||||
this.fillColor = `hsl(${mech.color.hue},${mech.color.sat}%,${mech.color.light}%)`
|
this.fillColor = `hsl(${mech.color.hue},${mech.color.sat}%,${mech.color.light}%)`
|
||||||
this.fillColorDark = `hsl(${mech.color.hue},${mech.color.sat}%,${mech.color.light-20}%)`
|
this.fillColorDark = `hsl(${mech.color.hue},${mech.color.sat}%,${mech.color.light-20}%)`
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -499,6 +499,15 @@ const powerUps = {
|
|||||||
},
|
},
|
||||||
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
|
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
|
||||||
if (level.levelsCleared < 4) { //runs 4 times on all difficulty levels
|
if (level.levelsCleared < 4) { //runs 4 times on all difficulty levels
|
||||||
|
|
||||||
|
//bonus power ups for clearing runs in the last game
|
||||||
|
if (level.levelsCleared === 0 && !game.isCheating) {
|
||||||
|
for (let i = 0; i < localSettings.levelsClearedLastGame / 5 - 1; i++) {
|
||||||
|
powerUps.spawn(x, y, "mod", false); //spawn a mod for every 5 levels cleared in last game
|
||||||
|
}
|
||||||
|
localSettings.levelsClearedLastGame = 0 //after getting bonus power ups reset run history
|
||||||
|
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||||
|
}
|
||||||
if (b.inventory.length === 0) {
|
if (b.inventory.length === 0) {
|
||||||
powerUps.spawn(x, y, "gun", false); //first gun
|
powerUps.spawn(x, y, "gun", false); //first gun
|
||||||
} else if (mod.totalCount === 0) { //first mod
|
} else if (mod.totalCount === 0) { //first mod
|
||||||
@@ -560,7 +569,7 @@ const powerUps = {
|
|||||||
!(mod.isEnergyNoAmmo && target === 'ammo')
|
!(mod.isEnergyNoAmmo && target === 'ammo')
|
||||||
) {
|
) {
|
||||||
powerUps.directSpawn(x, y, target, moving, mode)
|
powerUps.directSpawn(x, y, target, moving, mode)
|
||||||
if (mod.isBayesian && Math.random() < 0.3) powerUps.directSpawn(x, y, target, moving, mode)
|
if (mod.isBayesian && Math.random() < 0.2) powerUps.directSpawn(x, y, target, moving, mode)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
6
todo.txt
6
todo.txt
@@ -1,9 +1,3 @@
|
|||||||
blocks drift towards the center of pilot wave's field
|
|
||||||
|
|
||||||
mod: Bayesian statistics - no longer stops ammo spawns
|
|
||||||
30% to double power ups, but ejects a mod when you take damage
|
|
||||||
|
|
||||||
mod: exciton-lattice - 40% damage, but no ammo can spawn
|
|
||||||
|
|
||||||
************** TODO - n-gon **************
|
************** TODO - n-gon **************
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user