@@ -13,13 +13,16 @@ var setUpComponents = function(){
13
13
volume . music_vol = 1.0
14
14
object . tween ( { w : 200 } , 20 ) ;
15
15
} else if ( this . _x + 5 > e . realX ) {
16
- volume . music_vol = 1. 0
16
+ volume . music_vol = 0
17
17
object . tween ( { w : 0 } , 20 ) ;
18
18
} else {
19
- volume . music_vol = ( e . realX - ( this . _x + 10 ) ) / 200
19
+ volume . music_vol = ( e . realX - ( this . _x + 5 ) ) / 200
20
20
object . tween ( { w : e . realX - ( this . _x + 5 ) } , 20 ) ;
21
21
}
22
- Crafty . audio . play ( "background" , - 1 , change , true )
22
+ if ( volume . music_vol == 0 )
23
+ Crafty . audio . stop ( )
24
+ else
25
+ Crafty . audio . play ( "background" , - 1 , volume . music_vol , true )
23
26
}
24
27
else {
25
28
if ( this . _w + this . _x - 5 < e . realX ) {
@@ -29,7 +32,7 @@ var setUpComponents = function(){
29
32
volume . sound_vol = 1.0
30
33
object . tween ( { w : 0 } , 20 ) ;
31
34
} else {
32
- volume . sound_vol = ( e . realX - ( this . _x + 10 ) ) / 200
35
+ volume . sound_vol = ( e . realX - ( this . _x + 5 ) ) / 200
33
36
object . tween ( { w : e . realX - ( this . _x + 5 ) } , 20 ) ;
34
37
}
35
38
}
@@ -92,7 +95,7 @@ var setUpComponents = function(){
92
95
. fourway ( 3 )
93
96
. stopOnSolids ( )
94
97
. exitOnDoors ( )
95
- . attr ( { z : 3 } )
98
+ . attr ( { z : 2 } )
96
99
. animate ( 'PlayerMovingUp' , 3 , 3 , 5 )
97
100
. animate ( 'PlayerMovingRight' , 9 , 3 , 11 )
98
101
. animate ( 'PlayerMovingDown' , 0 , 3 , 2 )
@@ -140,7 +143,7 @@ var setUpComponents = function(){
140
143
this . onHit ( 'Door' , function ( ent ) {
141
144
var door = ent [ 0 ] . obj ;
142
145
if ( door . contains ( this . _x + ( this . _w / 2 ) - 5 , this . _y + ( this . _h / 2 ) - 5 , 10 , 10 ) ) {
143
- Crafty . audio . play ( "doorSound" ) ;
146
+ Crafty . audio . play ( "doorSound" , 1 , volume . sound_vol , false ) ;
144
147
exitLoc = door . at ( ) ;
145
148
load_scene ( door . ID , 40 ) ;
146
149
}
0 commit comments