@@ -20,6 +20,8 @@ var ElementFactory = function (game) {
20
20
sprite . docked = false ;
21
21
sprite . isShip = true ;
22
22
sprite . dockedTime = 0 ;
23
+ sprite . deathSound = _game . add . audio ( 'alien_explode' ) ;
24
+ sprite . dockSound = _game . add . audio ( 'alien_dock' ) ;
23
25
sprite . moveForward = function ( speed ) {
24
26
if ( ! this . docked ) {
25
27
if ( _game . physics . arcade . distanceToXY ( this . position , _game . world . centerX , _game . world . centerY ) > _game . world . width * 2 ) {
@@ -53,6 +55,7 @@ var ElementFactory = function (game) {
53
55
bullet = sprite1 . isbullet !== undefined ? sprite1 : bullet ;
54
56
bullet = sprite2 . isbullet !== undefined ? sprite2 : bullet ;
55
57
if ( planet !== null && ship !== null && ! ship . docked ) {
58
+ ship . dockSound . play ( ) ;
56
59
ship . animations . play ( 'dock' , null , false ) ;
57
60
ship . docked = true ;
58
61
ship . dockedTime = new Date ( ) ;
@@ -66,6 +69,7 @@ var ElementFactory = function (game) {
66
69
}
67
70
if ( ship . speedMultiplier > 1 ) {
68
71
clearInterval ( ship . drainInterval ) ;
72
+ sprite . deathSound . play ( ) ;
69
73
ship . animations . play ( 'death-pull' , null , false ) ;
70
74
ship . animations . currentAnim . onComplete . add ( function ( ) {
71
75
ship . kill ( ) ;
@@ -103,8 +107,10 @@ var ElementFactory = function (game) {
103
107
sprite . isPlanet = true ;
104
108
sprite . lastRegen = 0 ;
105
109
sprite . cooldown = 1000 ;
110
+ sprite . regenSound = _game . add . audio ( 'load_energy' ) ;
106
111
sprite . regenerate = function ( ) {
107
112
if ( new Date ( ) - this . lastRegen > this . cooldown && this . energy < 50 ) {
113
+ // sprite.regenSound.play(); // sound is too long
108
114
this . lastRegen = new Date ( ) ;
109
115
this . energy ++ ;
110
116
}
@@ -218,7 +224,6 @@ var ElementFactory = function (game) {
218
224
} else {
219
225
bullet . btnSound = _game . add . audio ( 'gravity_minus' ) ;
220
226
}
221
- ;
222
227
_game . sound . setDecodedCallback ( [ bullet . btnSound ] , function ( ) {
223
228
} , this ) ;
224
229
bullet . btnSound . play ( ) ;
0 commit comments