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/Bullets.js
1520 views
1
/**
2
* Created by stryker on 2014.03.05..
3
*/
4
define(function(){
5
var _game = null;
6
7
var _Bullets = function(quantity,type,damage){
8
var _bulletGroup = _game.add.group();
9
_bulletGroup.enableBody = true;
10
_bulletGroup.physicsBodyType = Phaser.Physics.ARCADE;
11
_bulletGroup.createMultiple(quantity,type);
12
_bulletGroup.setAll('anchor.x',0.5);
13
_bulletGroup.setAll('anchor.y',1);
14
_bulletGroup.setAll('outOfBoundsKill',true);
15
16
//costume property
17
_bulletGroup.setAll('bulletDamage',damage);
18
19
return{
20
getBulletGroup : function(){
21
return _bulletGroup;
22
}
23
}
24
25
};
26
27
return{
28
init: function(game){
29
_game = game;
30
},
31
preload: function(){
32
_game.load.image('bullet','assets/img/bullet.png');
33
_game.load.image('enemyBullet','assets/img/enemy-bullet.png');
34
},
35
create: function(quantity,type,damage){
36
return( new _Bullets(quantity,type,damage) );
37
}
38
}
39
});
40