-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanimation.js
74 lines (64 loc) · 1.76 KB
/
animation.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function createDudeAnimation(game) {
game.anims.create({
key: 'right',
frames: game.anims.generateFrameNumbers('dude', { start: 1, end: 3 }),
frameRate: 10,
repeat: -1
});
game.anims.create({
key: 'turnLeft',
frames: [ { key: 'dude', frame: 7 } ],
frameRate: 20
});
game.anims.create({
key: 'turnRight',
frames: [ { key: 'dude', frame: 0 } ],
frameRate: 20
});
game.anims.create({
key: 'left',
frames: game.anims.generateFrameNumbers('dude', { start: 8, end: 10 }),
frameRate: 10,
repeat: -1
});
}
function createTankAnimation(game) {
game.anims.create({
key: 'tankRight',
frames: game.anims.generateFrameNumbers('tank', { start: 6, end: 7 }),
frameRate: 10,
repeat: -1
});
game.anims.create({
key: 'tankLeft',
frames: game.anims.generateFrameNumbers('tank', { start: 2, end: 3 }),
frameRate: 10,
repeat: -1
});
game.anims.create({
key: 'tankUp',
frames: game.anims.generateFrameNumbers('tank', { start: 0, end: 1 }),
frameRate: 10,
repeat: -1
});
game.anims.create({
key: 'tankDown',
frames: game.anims.generateFrameNumbers('tank', { start: 4, end: 5 }),
frameRate: 10,
repeat: -1
});
}
function createBrickAnimation(game) {
game.anims.create({
key: 'brickStay',
frames: game.anims.generateFrameNumbers('tank', { start: 16, end: 16 }),
frameRate: 10,
repeat: 1
});
game.anims.create({
key: 'halfBrickStay',
frames: game.anims.generateFrameNumbers('tank', { start: 20, end: 20 }),
frameRate: 10,
repeat: 1
});
}