evotars 0.0.9 → 0.0.10
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/dist/evotars.js +26282 -0
- package/dist/evotars.umd.cjs +1147 -0
- package/dist/index.d.ts +175 -0
- package/package.json +16 -2
- package/.editorconfig +0 -13
- package/.prettierrc.json +0 -3
- package/index.html +0 -13
- package/playground/main.ts +0 -48
- package/playground/styles.css +0 -17
- package/public/evotars/agent/data.json +0 -18
- package/public/evotars/agent/sprite.json +0 -166
- package/public/evotars/agent/sprite.png +0 -0
- package/public/evotars/cat/data.json +0 -18
- package/public/evotars/cat/sprite.json +0 -231
- package/public/evotars/cat/sprite.png +0 -0
- package/public/evotars/dude/data.json +0 -18
- package/public/evotars/dude/sprite.json +0 -231
- package/public/evotars/dude/sprite.png +0 -0
- package/public/evotars/girl/data.json +0 -18
- package/public/evotars/girl/sprite.json +0 -231
- package/public/evotars/girl/sprite.png +0 -0
- package/public/evotars/nerd/data.json +0 -18
- package/public/evotars/nerd/sprite.json +0 -231
- package/public/evotars/nerd/sprite.png +0 -0
- package/public/evotars/senior/data.json +0 -18
- package/public/evotars/senior/sprite.json +0 -231
- package/public/evotars/senior/sprite.png +0 -0
- package/public/evotars/set.json +0 -10
- package/public/evotars/sith/data.json +0 -18
- package/public/evotars/sith/sprite.json +0 -166
- package/public/evotars/sith/sprite.png +0 -0
- package/public/evotars/sponge/data.json +0 -18
- package/public/evotars/sponge/sprite.json +0 -231
- package/public/evotars/sponge/sprite.png +0 -0
- package/public/fonts/Rubik.ttf +0 -0
- package/public/sounds/jump.mp3 +0 -0
- package/src/app.ts +0 -71
- package/src/config/constants.ts +0 -1
- package/src/entities/EmoteSpitter.ts +0 -102
- package/src/entities/Evotar.ts +0 -468
- package/src/entities/Message.ts +0 -164
- package/src/entities/Name.ts +0 -33
- package/src/entities/SpriteContainer.ts +0 -65
- package/src/entities/TrailEffect.ts +0 -73
- package/src/evotars.ts +0 -75
- package/src/evotarsManager.ts +0 -313
- package/src/helpers/timer.ts +0 -43
- package/src/helpers/types.ts +0 -4
- package/src/index.ts +0 -1
- package/src/services/soundService.ts +0 -30
- package/src/services/spriteService.ts +0 -167
- package/src/types/dto/action.ts +0 -79
- package/src/types/dto/chatter.ts +0 -4
- package/src/types/dto/event.ts +0 -9
- package/src/types/dto/index.ts +0 -6
- package/src/types/dto/message.ts +0 -8
- package/src/types/dto/settings.ts +0 -5
- package/src/types/dto/user.ts +0 -13
- package/src/types/index.ts +0 -1
- package/tsconfig.json +0 -23
- package/vite.config.js +0 -26
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
{ "frames": {
|
|
2
|
-
"sponge_Body_0": {
|
|
3
|
-
"frame": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
4
|
-
"rotated": false,
|
|
5
|
-
"trimmed": false,
|
|
6
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
7
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
8
|
-
"duration": 300
|
|
9
|
-
},
|
|
10
|
-
"sponge_Body_1": {
|
|
11
|
-
"frame": { "x": 32, "y": 0, "w": 32, "h": 32 },
|
|
12
|
-
"rotated": false,
|
|
13
|
-
"trimmed": false,
|
|
14
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
15
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
16
|
-
"duration": 300
|
|
17
|
-
},
|
|
18
|
-
"sponge_Body_2": {
|
|
19
|
-
"frame": { "x": 64, "y": 0, "w": 32, "h": 32 },
|
|
20
|
-
"rotated": false,
|
|
21
|
-
"trimmed": false,
|
|
22
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
23
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
24
|
-
"duration": 300
|
|
25
|
-
},
|
|
26
|
-
"sponge_Body_3": {
|
|
27
|
-
"frame": { "x": 96, "y": 0, "w": 32, "h": 32 },
|
|
28
|
-
"rotated": false,
|
|
29
|
-
"trimmed": false,
|
|
30
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
31
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
32
|
-
"duration": 100
|
|
33
|
-
},
|
|
34
|
-
"sponge_Body_4": {
|
|
35
|
-
"frame": { "x": 128, "y": 0, "w": 32, "h": 32 },
|
|
36
|
-
"rotated": false,
|
|
37
|
-
"trimmed": false,
|
|
38
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
39
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
40
|
-
"duration": 100
|
|
41
|
-
},
|
|
42
|
-
"sponge_Body_5": {
|
|
43
|
-
"frame": { "x": 160, "y": 0, "w": 32, "h": 32 },
|
|
44
|
-
"rotated": false,
|
|
45
|
-
"trimmed": false,
|
|
46
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
47
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
48
|
-
"duration": 100
|
|
49
|
-
},
|
|
50
|
-
"sponge_Body_6": {
|
|
51
|
-
"frame": { "x": 192, "y": 0, "w": 32, "h": 32 },
|
|
52
|
-
"rotated": false,
|
|
53
|
-
"trimmed": false,
|
|
54
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
55
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
56
|
-
"duration": 100
|
|
57
|
-
},
|
|
58
|
-
"sponge_Body_7": {
|
|
59
|
-
"frame": { "x": 224, "y": 0, "w": 32, "h": 32 },
|
|
60
|
-
"rotated": false,
|
|
61
|
-
"trimmed": false,
|
|
62
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
63
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
64
|
-
"duration": 100
|
|
65
|
-
},
|
|
66
|
-
"sponge_Body_8": {
|
|
67
|
-
"frame": { "x": 256, "y": 0, "w": 32, "h": 32 },
|
|
68
|
-
"rotated": false,
|
|
69
|
-
"trimmed": false,
|
|
70
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
71
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
72
|
-
"duration": 100
|
|
73
|
-
},
|
|
74
|
-
"sponge_Body_9": {
|
|
75
|
-
"frame": { "x": 288, "y": 0, "w": 32, "h": 32 },
|
|
76
|
-
"rotated": false,
|
|
77
|
-
"trimmed": false,
|
|
78
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
79
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
80
|
-
"duration": 300
|
|
81
|
-
},
|
|
82
|
-
"sponge_Body_10": {
|
|
83
|
-
"frame": { "x": 320, "y": 0, "w": 32, "h": 32 },
|
|
84
|
-
"rotated": false,
|
|
85
|
-
"trimmed": false,
|
|
86
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
87
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
88
|
-
"duration": 300
|
|
89
|
-
},
|
|
90
|
-
"sponge_Body_11": {
|
|
91
|
-
"frame": { "x": 352, "y": 0, "w": 32, "h": 32 },
|
|
92
|
-
"rotated": false,
|
|
93
|
-
"trimmed": false,
|
|
94
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
95
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
96
|
-
"duration": 300
|
|
97
|
-
},
|
|
98
|
-
"sponge_Body_12": {
|
|
99
|
-
"frame": { "x": 384, "y": 0, "w": 32, "h": 32 },
|
|
100
|
-
"rotated": false,
|
|
101
|
-
"trimmed": false,
|
|
102
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
103
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
104
|
-
"duration": 1000
|
|
105
|
-
},
|
|
106
|
-
"sponge_Eyes_0": {
|
|
107
|
-
"frame": { "x": 0, "y": 32, "w": 32, "h": 32 },
|
|
108
|
-
"rotated": false,
|
|
109
|
-
"trimmed": false,
|
|
110
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
111
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
112
|
-
"duration": 300
|
|
113
|
-
},
|
|
114
|
-
"sponge_Eyes_1": {
|
|
115
|
-
"frame": { "x": 32, "y": 32, "w": 32, "h": 32 },
|
|
116
|
-
"rotated": false,
|
|
117
|
-
"trimmed": false,
|
|
118
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
119
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
120
|
-
"duration": 300
|
|
121
|
-
},
|
|
122
|
-
"sponge_Eyes_2": {
|
|
123
|
-
"frame": { "x": 64, "y": 32, "w": 32, "h": 32 },
|
|
124
|
-
"rotated": false,
|
|
125
|
-
"trimmed": false,
|
|
126
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
127
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
128
|
-
"duration": 300
|
|
129
|
-
},
|
|
130
|
-
"sponge_Eyes_3": {
|
|
131
|
-
"frame": { "x": 96, "y": 32, "w": 32, "h": 32 },
|
|
132
|
-
"rotated": false,
|
|
133
|
-
"trimmed": false,
|
|
134
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
135
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
136
|
-
"duration": 100
|
|
137
|
-
},
|
|
138
|
-
"sponge_Eyes_4": {
|
|
139
|
-
"frame": { "x": 128, "y": 32, "w": 32, "h": 32 },
|
|
140
|
-
"rotated": false,
|
|
141
|
-
"trimmed": false,
|
|
142
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
143
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
144
|
-
"duration": 100
|
|
145
|
-
},
|
|
146
|
-
"sponge_Eyes_5": {
|
|
147
|
-
"frame": { "x": 160, "y": 32, "w": 32, "h": 32 },
|
|
148
|
-
"rotated": false,
|
|
149
|
-
"trimmed": false,
|
|
150
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
151
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
152
|
-
"duration": 100
|
|
153
|
-
},
|
|
154
|
-
"sponge_Eyes_6": {
|
|
155
|
-
"frame": { "x": 192, "y": 32, "w": 32, "h": 32 },
|
|
156
|
-
"rotated": false,
|
|
157
|
-
"trimmed": false,
|
|
158
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
159
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
160
|
-
"duration": 100
|
|
161
|
-
},
|
|
162
|
-
"sponge_Eyes_7": {
|
|
163
|
-
"frame": { "x": 224, "y": 32, "w": 32, "h": 32 },
|
|
164
|
-
"rotated": false,
|
|
165
|
-
"trimmed": false,
|
|
166
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
167
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
168
|
-
"duration": 100
|
|
169
|
-
},
|
|
170
|
-
"sponge_Eyes_8": {
|
|
171
|
-
"frame": { "x": 256, "y": 32, "w": 32, "h": 32 },
|
|
172
|
-
"rotated": false,
|
|
173
|
-
"trimmed": false,
|
|
174
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
175
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
176
|
-
"duration": 100
|
|
177
|
-
},
|
|
178
|
-
"sponge_Eyes_9": {
|
|
179
|
-
"frame": { "x": 288, "y": 32, "w": 32, "h": 32 },
|
|
180
|
-
"rotated": false,
|
|
181
|
-
"trimmed": false,
|
|
182
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
183
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
184
|
-
"duration": 300
|
|
185
|
-
},
|
|
186
|
-
"sponge_Eyes_10": {
|
|
187
|
-
"frame": { "x": 320, "y": 32, "w": 32, "h": 32 },
|
|
188
|
-
"rotated": false,
|
|
189
|
-
"trimmed": false,
|
|
190
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
191
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
192
|
-
"duration": 300
|
|
193
|
-
},
|
|
194
|
-
"sponge_Eyes_11": {
|
|
195
|
-
"frame": { "x": 352, "y": 32, "w": 32, "h": 32 },
|
|
196
|
-
"rotated": false,
|
|
197
|
-
"trimmed": false,
|
|
198
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
199
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
200
|
-
"duration": 300
|
|
201
|
-
},
|
|
202
|
-
"sponge_Eyes_12": {
|
|
203
|
-
"frame": { "x": 384, "y": 32, "w": 32, "h": 32 },
|
|
204
|
-
"rotated": false,
|
|
205
|
-
"trimmed": false,
|
|
206
|
-
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
|
|
207
|
-
"sourceSize": { "w": 32, "h": 32 },
|
|
208
|
-
"duration": 1000
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
"meta": {
|
|
212
|
-
"app": "https://www.aseprite.org/",
|
|
213
|
-
"version": "1.x-dev",
|
|
214
|
-
"image": "sponge.png",
|
|
215
|
-
"format": "RGBA8888",
|
|
216
|
-
"size": { "w": 416, "h": 64 },
|
|
217
|
-
"scale": "1",
|
|
218
|
-
"frameTags": [
|
|
219
|
-
{ "name": "Idle", "from": 0, "to": 2, "direction": "forward", "color": "#000000ff" },
|
|
220
|
-
{ "name": "Jump", "from": 3, "to": 3, "direction": "forward", "color": "#000000ff" },
|
|
221
|
-
{ "name": "Fall", "from": 4, "to": 4, "direction": "forward", "color": "#000000ff" },
|
|
222
|
-
{ "name": "Land", "from": 5, "to": 5, "direction": "forward", "color": "#000000ff" },
|
|
223
|
-
{ "name": "Run", "from": 6, "to": 8, "direction": "forward", "color": "#000000ff" },
|
|
224
|
-
{ "name": "Die", "from": 9, "to": 12, "direction": "forward", "color": "#000000ff" }
|
|
225
|
-
],
|
|
226
|
-
"layers": [
|
|
227
|
-
{ "name": "Body", "opacity": 255, "blendMode": "normal" },
|
|
228
|
-
{ "name": "Eyes", "opacity": 255, "blendMode": "normal" }
|
|
229
|
-
]
|
|
230
|
-
}
|
|
231
|
-
}
|
|
Binary file
|
package/public/fonts/Rubik.ttf
DELETED
|
Binary file
|
package/public/sounds/jump.mp3
DELETED
|
Binary file
|
package/src/app.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as PIXI from 'pixi.js';
|
|
2
|
-
import { Evotar } from './entities/Evotar';
|
|
3
|
-
import { timers } from './helpers/timer';
|
|
4
|
-
import { evotarsManager } from './evotarsManager';
|
|
5
|
-
import { SoundOptions, soundService } from './services/soundService';
|
|
6
|
-
import { SettingsEntity } from './types';
|
|
7
|
-
import { SpriteLoaderFn, spriteService } from './services/spriteService';
|
|
8
|
-
|
|
9
|
-
export type AppOptions = {
|
|
10
|
-
font?: string;
|
|
11
|
-
sounds?: SoundOptions;
|
|
12
|
-
spriteLoaderFn: SpriteLoaderFn;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export class App {
|
|
16
|
-
public stage: PIXI.Container = new PIXI.Container();
|
|
17
|
-
public evotars: Record<string, Evotar> = {};
|
|
18
|
-
|
|
19
|
-
public chatterIds: string[] = [];
|
|
20
|
-
|
|
21
|
-
public settings: SettingsEntity = {};
|
|
22
|
-
|
|
23
|
-
public renderer!: PIXI.Renderer;
|
|
24
|
-
|
|
25
|
-
public font?: string;
|
|
26
|
-
|
|
27
|
-
public async initialize(
|
|
28
|
-
element: HTMLElement,
|
|
29
|
-
options: AppOptions,
|
|
30
|
-
): Promise<void> {
|
|
31
|
-
this.font = options.font;
|
|
32
|
-
|
|
33
|
-
spriteService.initialize(options.spriteLoaderFn);
|
|
34
|
-
soundService.initialize(options.sounds);
|
|
35
|
-
|
|
36
|
-
this.renderer = new PIXI.Renderer({
|
|
37
|
-
width: element.clientWidth,
|
|
38
|
-
height: element.clientHeight,
|
|
39
|
-
backgroundAlpha: 0,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
element.appendChild(this.renderer.view as HTMLCanvasElement);
|
|
43
|
-
|
|
44
|
-
window.onresize = (): void => {
|
|
45
|
-
this.renderer.resize(element.clientWidth, element.clientHeight);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
this.stage.sortableChildren = true;
|
|
49
|
-
|
|
50
|
-
evotarsManager.subscribe({
|
|
51
|
-
onAdd: (evotar: Evotar) => this.stage.addChild(evotar.container),
|
|
52
|
-
onDelete: (evotar: Evotar) => {
|
|
53
|
-
this.stage.removeChild(evotar.container);
|
|
54
|
-
this.stage.removeChild(evotar.trail.container);
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public updateSettings(data: SettingsEntity): void {
|
|
60
|
-
this.settings = data;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public update(): void {
|
|
64
|
-
timers.tick();
|
|
65
|
-
evotarsManager.update();
|
|
66
|
-
|
|
67
|
-
this.renderer.render(this.stage);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export const app = new App();
|
package/src/config/constants.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const FIXED_DELTA_TIME = 0.02 * 1000;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import * as PIXI from 'pixi.js';
|
|
2
|
-
import '@pixi/gif';
|
|
3
|
-
import { Point } from '../helpers/types';
|
|
4
|
-
import { Timer } from '../helpers/timer';
|
|
5
|
-
import { FIXED_DELTA_TIME } from '../config/constants';
|
|
6
|
-
import { AnimatedGIF } from '@pixi/gif';
|
|
7
|
-
|
|
8
|
-
export type EvotarEmoteSpitterProps = {
|
|
9
|
-
position: Point;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const GIFCache: Record<string, AnimatedGIF> = {};
|
|
13
|
-
|
|
14
|
-
export class EvotarEmoteSpitter {
|
|
15
|
-
public container: PIXI.Container = new PIXI.Container();
|
|
16
|
-
|
|
17
|
-
private emotes: PIXI.Sprite[] = [];
|
|
18
|
-
|
|
19
|
-
private moveSpeed = 50;
|
|
20
|
-
private alphaSpeed = 1;
|
|
21
|
-
private scaleSpeed = 0.5;
|
|
22
|
-
|
|
23
|
-
private timer?: Timer;
|
|
24
|
-
|
|
25
|
-
public async add(url: string): Promise<void> {
|
|
26
|
-
const cachedGIF = GIFCache[url];
|
|
27
|
-
|
|
28
|
-
let image;
|
|
29
|
-
|
|
30
|
-
if (cachedGIF) {
|
|
31
|
-
image = cachedGIF.clone();
|
|
32
|
-
} else {
|
|
33
|
-
const res = await fetch(url);
|
|
34
|
-
const contentType = res.headers.get('content-type');
|
|
35
|
-
|
|
36
|
-
switch (contentType) {
|
|
37
|
-
case 'image/gif': {
|
|
38
|
-
const buffer = await res.arrayBuffer();
|
|
39
|
-
image = AnimatedGIF.fromBuffer(buffer);
|
|
40
|
-
GIFCache[url] = image;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
case 'image/png': {
|
|
44
|
-
image = PIXI.Sprite.from(url);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
default: {
|
|
48
|
-
console.warn('Unsupported content type: ', contentType);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (image) {
|
|
55
|
-
image.anchor.set(0.5, 0.5);
|
|
56
|
-
image.scale.set(0, 0);
|
|
57
|
-
|
|
58
|
-
this.emotes.push(image);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private isAnimatedGIF(sprite: any): sprite is AnimatedGIF {
|
|
63
|
-
return sprite.currentFrame;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public update(props: EvotarEmoteSpitterProps): void {
|
|
67
|
-
this.timer?.tick();
|
|
68
|
-
|
|
69
|
-
if (!this.timer || this.timer.isCompleted) {
|
|
70
|
-
if (this.emotes.length > 0) {
|
|
71
|
-
this.timer = new Timer(2000, () => {
|
|
72
|
-
const sprite = this.emotes.shift();
|
|
73
|
-
|
|
74
|
-
if (sprite) {
|
|
75
|
-
if (this.isAnimatedGIF(sprite)) {
|
|
76
|
-
sprite.currentFrame = 0;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.container.addChild(sprite);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
this.container.position.x = props.position.x ?? this.container.position.x;
|
|
86
|
-
this.container.position.y = props.position.y ?? this.container.position.y;
|
|
87
|
-
|
|
88
|
-
for (const child of this.container.children) {
|
|
89
|
-
child.position.y -= (FIXED_DELTA_TIME * this.moveSpeed) / 1000;
|
|
90
|
-
child.scale.x += (FIXED_DELTA_TIME * this.scaleSpeed) / 1000;
|
|
91
|
-
child.scale.y += (FIXED_DELTA_TIME * this.scaleSpeed) / 1000;
|
|
92
|
-
|
|
93
|
-
if (child.scale.x > 1) {
|
|
94
|
-
child.alpha -= (FIXED_DELTA_TIME * this.alphaSpeed) / 1000;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (child.alpha <= 0) {
|
|
98
|
-
this.container.removeChild(child);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|