dopaminejs 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +71 -0
- package/CHANGELOG.md +27 -0
- package/README.md +189 -60
- package/dist/dopamine.mjs +414 -317
- package/dist/dopamine.umd.js +6 -6
- package/package.json +13 -7
- package/src/audio/SoundManager.js +122 -17
- package/src/core/DataService.js +6 -7
- package/src/core/EventEmitter.js +58 -0
- package/src/core/RewardSystem.js +12 -34
- package/src/effects/ParticleSystem.js +5 -7
- package/src/index.js +48 -11
- package/src/ui/GameUI.js +8 -11
package/src/ui/GameUI.js
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* Reusable UI elements for XP bars, achievement popups, level-up screens, etc.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { particleSystem } from '../effects/ParticleSystem.js';
|
|
7
|
-
|
|
8
6
|
export class GameUI {
|
|
9
|
-
constructor() {
|
|
7
|
+
constructor(particleSystem) {
|
|
8
|
+
this.particleSystem = particleSystem;
|
|
10
9
|
this.container = null;
|
|
11
10
|
this.xpBar = null;
|
|
12
11
|
this.levelDisplay = null;
|
|
@@ -119,7 +118,7 @@ export class GameUI {
|
|
|
119
118
|
// Trigger confetti at popup location
|
|
120
119
|
setTimeout(() => {
|
|
121
120
|
const rect = popup.getBoundingClientRect();
|
|
122
|
-
particleSystem.confetti(rect.left + rect.width / 2, rect.top + rect.height / 2, 40);
|
|
121
|
+
this.particleSystem.confetti(rect.left + rect.width / 2, rect.top + rect.height / 2, 40);
|
|
123
122
|
}, 300);
|
|
124
123
|
|
|
125
124
|
// Remove after animation
|
|
@@ -151,7 +150,7 @@ export class GameUI {
|
|
|
151
150
|
setTimeout(() => {
|
|
152
151
|
const x = Math.random() * window.innerWidth;
|
|
153
152
|
const y = Math.random() * window.innerHeight * 0.6;
|
|
154
|
-
particleSystem.confetti(x, y, 30);
|
|
153
|
+
this.particleSystem.confetti(x, y, 30);
|
|
155
154
|
}, i * 200);
|
|
156
155
|
}
|
|
157
156
|
}, 300);
|
|
@@ -185,7 +184,7 @@ export class GameUI {
|
|
|
185
184
|
*/
|
|
186
185
|
showCombo(multiplier, x, y) {
|
|
187
186
|
this.showFloatingText(`${multiplier}× COMBO!`, x, y, '#ff6b6b', '32px');
|
|
188
|
-
particleSystem.fire(x, y, 20);
|
|
187
|
+
this.particleSystem.fire(x, y, 20);
|
|
189
188
|
}
|
|
190
189
|
|
|
191
190
|
/**
|
|
@@ -193,7 +192,7 @@ export class GameUI {
|
|
|
193
192
|
*/
|
|
194
193
|
showNearMiss(x, y) {
|
|
195
194
|
this.showFloatingText('CLOSE CALL!', x, y, '#45b7d1', '20px');
|
|
196
|
-
particleSystem.sparkle(x, y, 15, '#45b7d1');
|
|
195
|
+
this.particleSystem.sparkle(x, y, 15, '#45b7d1');
|
|
197
196
|
}
|
|
198
197
|
|
|
199
198
|
/**
|
|
@@ -201,8 +200,8 @@ export class GameUI {
|
|
|
201
200
|
*/
|
|
202
201
|
showLuckyMoment(multiplier, x, y) {
|
|
203
202
|
this.showFloatingText(`LUCKY ${multiplier}×!`, x, y, '#ffd700', '36px');
|
|
204
|
-
particleSystem.starBurst(x, y, 12);
|
|
205
|
-
particleSystem.confetti(x, y, 25);
|
|
203
|
+
this.particleSystem.starBurst(x, y, 12);
|
|
204
|
+
this.particleSystem.confetti(x, y, 25);
|
|
206
205
|
}
|
|
207
206
|
|
|
208
207
|
/**
|
|
@@ -254,5 +253,3 @@ export class GameUI {
|
|
|
254
253
|
document.body.appendChild(overlay);
|
|
255
254
|
}
|
|
256
255
|
}
|
|
257
|
-
|
|
258
|
-
export const gameUI = new GameUI();
|