/
stagger play 1.js
48 lines (39 loc) · 1022 Bytes
/
stagger play 1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class Example extends Phaser.Scene
{
constructor ()
{
super();
}
preload ()
{
this.load.spritesheet('diamonds', 'assets/sprites/diamonds32x24x5.png', { frameWidth: 32, frameHeight: 24 });
}
create ()
{
const config = {
key: 'flash',
frames: this.anims.generateFrameNumbers('diamonds', { start: 0, end: 4 }),
frameRate: 1,
repeat: -1
};
this.anims.create(config);
const group = this.add.group();
group.createMultiple({ key: 'diamonds', frame: 0, repeat: 279 });
Phaser.Actions.GridAlign(group.getChildren(), {
width: 20,
height: 20,
cellWidth: 38,
x: 19,
y: 25
});
this.anims.staggerPlay('flash', group.getChildren(), 60);
}
}
const config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 800,
height: 600,
scene: Example
};
const game = new Phaser.Game(config);