1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-28 02:51:55 +00:00

Clear particles with an associated layer when leaving that layer

This commit is contained in:
Harley White 2021-05-14 15:43:10 -04:00
parent 4f831f51b0
commit 96cecedec5
3 changed files with 7 additions and 4 deletions

View file

@ -527,7 +527,6 @@ addLayer("a", {
},
},
midsection: ["grid", "blank"],
marked: true,
grid: {
maxRows: 3,
rows: 2,
@ -560,7 +559,7 @@ addLayer("a", {
const coolParticle = {
image:"options_wheel.png",
spread: 20,
gravity: 0,
gravity: 2,
time: 9999,
rotation (id) {
return 20 * (id - 1.5) + (Math.random() - 0.5) * 10
@ -569,7 +568,7 @@ const coolParticle = {
return (Math.random() - 0.5) * 10
},
speed() {
0
return (Math.random() + 1.2) * 8
},
onClick() {
console.log("yay")
@ -579,5 +578,6 @@ const coolParticle = {
},
update() {
//this.width += 1
}
},
layer: 'f',
}

View file

@ -335,6 +335,7 @@ function gameLoop(diff) {
if (gameEnded && !player.keepGoing) {
diff = 0
player.tab = "gameEnded"
clearParticles()
}
if (player.devSpeed) diff *= player.devSpeed

View file

@ -138,6 +138,7 @@ function inChallenge(layer, id) {
var onTreeTab = true
function showTab(name) {
if (LAYERS.includes(name) && !layerunlocked(name)) return
if (player.tab !== name) clearParticles(function(p) {return p.layer === player.tab})
if (player.tab === name && isPlainObject(tmp[name].tabFormat)) {
player.subtabs[name].mainTabs = Object.keys(layers[name].tabFormat)[0]
}
@ -153,6 +154,7 @@ function showTab(name) {
function showNavTab(name) {
if (LAYERS.includes(name) && !layerunlocked(name)) return
if (player.navTab !== name) clearParticles(function(p) {return p.layer === player.navTab})
var toTreeTab = name == "tree"
player.navTab = name