-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExplosion.js
More file actions
38 lines (34 loc) · 873 Bytes
/
Explosion.js
File metadata and controls
38 lines (34 loc) · 873 Bytes
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
/**
* Usage new Explosion(Game.stage, x, y)
* @param parent
* @param posX
* @param posY
* @returns {createjs.Sprite|*}
* @constructor
*/
var Explosion = function (parent, posX, posY) {
'use strict';
var my, data = {
images: ["img/explode_1.png"],
frames: {
width: 96,
height: 96,
regX: 32,
regY: 32
},
framerate:12,
animations: {
explode: [0, 16]
}
};
var spriteSheet = new createjs.SpriteSheet(data);
my = new createjs.Sprite(spriteSheet);
my.x = posX;
my.y = posY;
parent.addChild(my);
my.gotoAndPlay("explode");
my.addEventListener("animationend", function () {
parent.removeChild(my);
});
return my;
};