dopaminejs 1.1.0 → 1.2.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/CHANGELOG.md +9 -0
- package/README.md +51 -0
- package/dist/dopamine.mjs +291 -278
- package/dist/dopamine.umd.js +11 -11
- package/package.json +1 -1
- package/src/effects/ParticleSystem.js +201 -131
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.0] - 2025-12-04
|
|
6
|
+
### Added
|
|
7
|
+
- **Visual Customization**:
|
|
8
|
+
- `registerSprite(key, url)`: Use custom images for particles.
|
|
9
|
+
- `emit(config)`: Create fully custom particle explosions.
|
|
10
|
+
- `registerEffect(name, callback)`: Define reusable custom effects.
|
|
11
|
+
- **Multi-Screen Support**: Pass `container` selector to `ParticleSystem` to target specific elements.
|
|
12
|
+
- **Optimization**: Implemented Object Pooling to reduce garbage collection and improve performance.
|
|
13
|
+
|
|
5
14
|
## [1.1.0] - 2025-12-04
|
|
6
15
|
### Added
|
|
7
16
|
- **Audio Extensibility**: Support for custom audio files (`.mp3`, `.wav`).
|
package/README.md
CHANGED
|
@@ -143,6 +143,57 @@ const app = new Dopamine({
|
|
|
143
143
|
});
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
+
### 🎨 Visual Customization (New in v1.2.0)
|
|
147
|
+
|
|
148
|
+
#### Custom Sprites
|
|
149
|
+
Use your own images instead of shapes.
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
// 1. Register sprite
|
|
153
|
+
particleSystem.registerSprite('gold_coin', '/assets/coin.png');
|
|
154
|
+
|
|
155
|
+
// 2. Emit particles using that sprite
|
|
156
|
+
particleSystem.emit({
|
|
157
|
+
x: 100, y: 100,
|
|
158
|
+
sprite: 'gold_coin',
|
|
159
|
+
count: 10,
|
|
160
|
+
size: 20,
|
|
161
|
+
gravity: 0.5
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### Custom Effects
|
|
166
|
+
Create reusable effects that you can call anywhere.
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
// Define "Blood Splatter"
|
|
170
|
+
particleSystem.registerEffect('blood', (x, y) => {
|
|
171
|
+
particleSystem.emit({
|
|
172
|
+
x, y,
|
|
173
|
+
count: 15,
|
|
174
|
+
color: ['#8a0303', '#ff0000'],
|
|
175
|
+
speed: 4,
|
|
176
|
+
gravity: 0.3,
|
|
177
|
+
decay: 0.05
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Use it
|
|
182
|
+
particleSystem.play('blood', 200, 300);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
#### Multi-Screen Support
|
|
186
|
+
Target a specific game container instead of the whole screen.
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
const app = new Dopamine({
|
|
190
|
+
particles: {
|
|
191
|
+
container: '#game-board', // Selector or HTMLElement
|
|
192
|
+
zIndex: 10
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
146
197
|
### 🎨 Game UI
|
|
147
198
|
Built-in UI components to show progress without coding HTML/CSS.
|
|
148
199
|
- **Notifications**: "Achievement Unlocked", "Level Up", etc.
|