BlueGit

blue-star speeltuin

fix fruit menu

timfa Tim · pushed by timfa

Authored 2022-10-21 · 4 years ago

Hash
653258456858f1c178912e6b88dc42fca4313505
Parent
95658e14
2 files changed +6 −1
src/minigame/frog/frogScene.js +2 −0
@@ -162,6 +162,8 @@ class FrogScene extends Scene
162 162 this.destroyFruit(fruit);
163 163
164 164 this.increaseDifficulty();
165
166 FruitInventory.Instance.addToInventory(fruit.renderer.subImage);
165 167 }
166 168
167 169 getNextExternalFruitPosition ()
@@ -162,6 +162,8 @@ class FrogScene extends Scene
162 this.destroyFruit(fruit);
162 this.destroyFruit(fruit);
163
163
164 this.increaseDifficulty();
164 this.increaseDifficulty();
165
166 FruitInventory.Instance.addToInventory(fruit.renderer.subImage);
165 }
167 }
166
168
167 getNextExternalFruitPosition ()
169 getNextExternalFruitPosition ()
src/objects/menus/fruitInventory.js +4 −1
@@ -13,8 +13,11 @@ class FruitInventory extends GameObject
13 13 if (!this.g_inv)
14 14 {
15 15 let inv = CookieManager.getCookie("fruitInventory");
16 inv = inv || "{}";
16 if (inv.length <= 0)
17 inv = "[]";
18
17 19 this.g_inv = JSON.parse(inv);
20 this.g_inv = this.g_inv || [];
18 21 }
19 22
20 23 return this.g_inv;
@@ -13,8 +13,11 @@ class FruitInventory extends GameObject
13 if (!this.g_inv)
13 if (!this.g_inv)
14 {
14 {
15 let inv = CookieManager.getCookie("fruitInventory");
15 let inv = CookieManager.getCookie("fruitInventory");
16 inv = inv || "{}";
16 if (inv.length <= 0)
17 inv = "[]";
18
17 this.g_inv = JSON.parse(inv);
19 this.g_inv = JSON.parse(inv);
20 this.g_inv = this.g_inv || [];
18 }
21 }
19
22
20 return this.g_inv;
23 return this.g_inv;