22const ctxSight = document . getElementById ( 'sight' ) . getContext ( '2d' )
33
44// eslint-disable-next-line no-unused-vars
5- const [ drawCollitions , noShadows ] = [ false , false ]
5+ const [ drawCollitions , noShadows , noSounds ] = [ true , true , true ]
66// eslint-disable-next-line no-unused-vars
77const game = {
88 objects : { } ,
@@ -13,10 +13,13 @@ const game = {
1313 ticker ( ) {
1414 if ( this . stepValue === 10 ) this . stepValue = 0
1515 this . stepValue += 1
16- const stepSound = [ 'F2' , 'C2' ] [ this . stepValue % 2 ]
17- playNote ( createSoundMap ( [ stepSound ] , [ 400 ] ) )
16+ if ( ! noSounds ) {
17+ const stepSound = [ 'F2' , 'C2' ] [ this . stepValue % 2 ]
18+ playNote ( createSoundMap ( [ stepSound ] , [ 400 ] ) )
19+ }
1820 if ( this . timer ) clearInterval ( this . timer )
1921 Vigilance . ctx . clearRect ( 0 , 0 , 512 , 512 )
22+ Vigilance . ctxSight . clearRect ( 0 , 0 , 512 , 512 )
2023 Vigilance . instances
2124 . filter ( vg => vg . props . start )
2225 . forEach ( vg => {
@@ -156,14 +159,14 @@ const game = {
156159 }
157160 }
158161
159- Vigilance . ctx . beginPath ( )
162+ Vigilance . ctxSight . beginPath ( )
160163 sombra . forEach ( ( val , index ) => {
161164 if ( val === 0 ) return
162- Vigilance . ctx . rect ( ( index % 32 ) * 16 , Math . floor ( index / 32 ) * 16 , 16 , 16 )
165+ Vigilance . ctxSight . rect ( ( index % 32 ) * 16 , Math . floor ( index / 32 ) * 16 , 16 , 16 )
163166 } )
164- Vigilance . ctx . fillStyle = `${ this . palette [ 11 ] } 66`
165- Vigilance . ctx . fill ( )
166- Vigilance . ctx . closePath ( )
167+ Vigilance . ctxSight . fillStyle = `${ this . palette [ 11 ] } 66`
168+ Vigilance . ctxSight . fill ( )
169+ Vigilance . ctxSight . closePath ( )
167170 } ,
168171 setSight ( ) {
169172 if ( noShadows ) return
0 commit comments