File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -120,11 +120,31 @@ var sound = new Howl({
120120
121121var frame = 0 ;
122122
123+ var lose = lose_dialog_shown = false ;
124+
123125var animate = function ( ) {
124126 frame ++ ;
125127
126128 requestAnimationFrame ( animate ) ;
127129
130+ if ( lose ) {
131+ if ( ! lose_dialog_shown ) {
132+ lose_dialog_shown = true ;
133+
134+ var i_concat = '' ;
135+
136+ for ( var i = 0 ; i < trails . length ; i ++ ) {
137+ i_concat = i_concat + 'I' ;
138+ }
139+
140+ alerted = true ;
141+
142+ alert ( 'YEAH BO' + i_concat + "\nScore: " + trails . length ) ;
143+ }
144+
145+ return ;
146+ }
147+
128148 oscillateCamera ( ) ;
129149
130150 for ( var i = 0 ; i < obstacles . length ; i ++ ) {
@@ -191,7 +211,7 @@ var animate = function () {
191211 if ( collisionResults . length > 0 && collisionResults [ 0 ] . distance < directionVector . length ( ) ) {
192212 sound . pause ( ) ;
193213
194- throw Error ( 'game over!' ) ;
214+ lose = true ;
195215 }
196216 }
197217
You can’t perform that action at this time.
0 commit comments