Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
FogNetwork
GitHub Repository: FogNetwork/Tsunami
Path: blob/main/public/games/files/space-invaders/assets/javascript/module/Explosions.js
1520 views
1
define(function(){
2
var _game = null;
3
4
var _Exploisons = function(quantity,type){
5
var _explosions = _game.add.group();
6
_explosions.createMultiple(quantity,type);
7
_explosions.forEach(setupExploisons,this);
8
9
var _type = type;
10
11
function setupExploisons(exploison){
12
exploison.anchor.x = 0.5;
13
exploison.anchor.y = 0.5;
14
exploison.animations.add(type);
15
}
16
17
return{
18
getExplosionGroup: function(){
19
return _explosions;
20
}
21
}
22
23
}
24
25
return{
26
init: function(game){
27
_game = game;
28
},
29
preload: function(){
30
_game.load.spritesheet('kaboom','assets/img/explode.png',128,128);
31
},
32
create: function(quantity,type){
33
return( new _Exploisons(quantity,type));
34
}
35
}
36
});
37