BlueGit

blue-star speeltuin

fruitinv

timfa Tim · pushed by timfa

Authored 2022-10-22 · 4 years ago

Hash
87ba499ea2cf98b1a13c758a24d9e978d00a30f4
Parent
fbb32e05
2 files changed +10 −6
src/objects/menus/fruitInventory.js +8 −6
@@ -5,9 +5,9 @@ class FruitInventory extends GameObject
5 5 closeBtnY = -140;
6 6 state = 0;
7 7
8 hBounds = 100;
9 vBounds = 110;
10 vOffset = 30;
8 hBounds = 120;
9 vBounds = 120;
10 vOffset = 20;
11 11
12 12 static Instance = null;
13 13
@@ -116,12 +116,12 @@ class FruitInventory extends GameObject
116 116 this.fruitInventoryButtons[i].transform.position.x = this.transform.position.x + xp;
117 117 this.fruitInventoryButtons[i].transform.position.y = this.transform.position.y + yp + this.vOffset;
118 118
119 yp += this.scene.game.images.fruit.height;
119 yp += this.scene.game.images.fruit.height * this.fruitInventoryButtons[i].transform.scale.y;
120 120
121 121 if (yp > this.vBounds)
122 122 {
123 123 yp = -this.vBounds;
124 xp += this.scene.game.images.fruit.width;
124 xp += this.scene.game.images.fruit.width * this.fruitInventoryButtons[i].transform.scale.x;
125 125 }
126 126 }
127 127 }
@@ -138,9 +138,11 @@ class FruitInventory extends GameObject
138 138
139 139 this.clearFruitButtons();
140 140
141 let spawnedAndBelowMax = true;
142
141 143 for (let t = 0; t < this.scene.game.images.fruit.subImages; t++)
142 144 {
143 let amount = Math.min(10, this.getFruitAmountOfType(t));
145 let amount = Math.min(17, this.getFruitAmountOfType(t));
144 146
145 147 for (let i = 0; i < amount; i++)
146 148 {
@@ -5,9 +5,9 @@ class FruitInventory extends GameObject
5 closeBtnY = -140;
5 closeBtnY = -140;
6 state = 0;
6 state = 0;
7
7
8 hBounds = 100;
8 hBounds = 120;
9 vBounds = 110;
9 vBounds = 120;
10 vOffset = 30;
10 vOffset = 20;
11
11
12 static Instance = null;
12 static Instance = null;
13
13
@@ -116,12 +116,12 @@ class FruitInventory extends GameObject
116 this.fruitInventoryButtons[i].transform.position.x = this.transform.position.x + xp;
116 this.fruitInventoryButtons[i].transform.position.x = this.transform.position.x + xp;
117 this.fruitInventoryButtons[i].transform.position.y = this.transform.position.y + yp + this.vOffset;
117 this.fruitInventoryButtons[i].transform.position.y = this.transform.position.y + yp + this.vOffset;
118
118
119 yp += this.scene.game.images.fruit.height;
119 yp += this.scene.game.images.fruit.height * this.fruitInventoryButtons[i].transform.scale.y;
120
120
121 if (yp > this.vBounds)
121 if (yp > this.vBounds)
122 {
122 {
123 yp = -this.vBounds;
123 yp = -this.vBounds;
124 xp += this.scene.game.images.fruit.width;
124 xp += this.scene.game.images.fruit.width * this.fruitInventoryButtons[i].transform.scale.x;
125 }
125 }
126 }
126 }
127 }
127 }
@@ -138,9 +138,11 @@ class FruitInventory extends GameObject
138
138
139 this.clearFruitButtons();
139 this.clearFruitButtons();
140
140
141 let spawnedAndBelowMax = true;
142
141 for (let t = 0; t < this.scene.game.images.fruit.subImages; t++)
143 for (let t = 0; t < this.scene.game.images.fruit.subImages; t++)
142 {
144 {
143 let amount = Math.min(10, this.getFruitAmountOfType(t));
145 let amount = Math.min(17, this.getFruitAmountOfType(t));
144
146
145 for (let i = 0; i < amount; i++)
147 for (let i = 0; i < amount; i++)
146 {
148 {
src/objects/menus/fruitInventoryButton.js +2 −0
@@ -7,6 +7,8 @@ class FruitInventoryButton extends SubBtn
7 7 super(x, y, sprite, layer);
8 8 this.type = type;
9 9 this.renderer.subImage = type;
10 this.transform.scale.x = 0.5;
11 this.transform.scale.y = 0.5;
10 12 }
11 13
12 14 onClick (btns)
@@ -7,6 +7,8 @@ class FruitInventoryButton extends SubBtn
7 super(x, y, sprite, layer);
7 super(x, y, sprite, layer);
8 this.type = type;
8 this.type = type;
9 this.renderer.subImage = type;
9 this.renderer.subImage = type;
10 this.transform.scale.x = 0.5;
11 this.transform.scale.y = 0.5;
10 }
12 }
11
13
12 onClick (btns)
14 onClick (btns)