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
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
bgm: {
default: null,
type: cc.AudioClip
},
星星: {
default: null,
type: cc.AudioClip
},
爆炸: {
default: null,
type: cc.AudioClip
},
眩晕: {
default: null,
type: cc.AudioClip
},
砸: {
default: null,
type: cc.AudioClip
},
移动: {
default: null,
type: cc.AudioClip
},
结束: {
default: null,
type: cc.AudioClip
},
点击: {
default: null,
type: cc.AudioClip
},
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start() {
},
playEffect(name, loop = false, volume = 1) {
cc.audioEngine.play(this[name], loop, volume);
}
// update (dt) {},
});