@@ -232,38 +232,37 @@ public class GameScene: SKScene, SKPhysicsContactDelegate {
232232
233233 //these don't need to be ranges anymore cuz we stopped using random values, fix later
234234 switch bodyANode. position. x {
235- case - 350 ... - 300 :
236- checkNote ( length: length, noteToPlay: " C1 " )
237- case - 299 ... - 250 :
238- checkNote ( length: length, noteToPlay: " D1 " )
239- case - 249 ... - 200 :
240- checkNote ( length: length, noteToPlay: " E1 " )
241- case - 199 ... - 150 :
242- checkNote ( length: length, noteToPlay: " F1 " )
243- case - 149 ... - 100 :
244- checkNote ( length: length, noteToPlay: " G1 " )
245- case - 99 ... - 50 :
246- checkNote ( length: length, noteToPlay: " A1 " )
247- case - 49 ... 0 :
248- checkNote ( length: length, noteToPlay: " B1 " )
249- case 1 ... 50 :
250- checkNote ( length: length, noteToPlay: " C2 " )
251- case 51 ... 100 :
252- checkNote ( length: length, noteToPlay: " D2 " )
253- case 101 ... 150 :
254- checkNote ( length: length, noteToPlay: " E2 " )
255- case 151 ... 200 :
256- checkNote ( length: length, noteToPlay: " F2 " )
257- case 201 ... 250 :
258- checkNote ( length: length, noteToPlay: " G2 " )
259- case 251 ... 300 :
260- checkNote ( length: length, noteToPlay: " A2 " )
261- case 301 ... 350 :
262- checkNote ( length: length, noteToPlay: " B2 " )
263- default :
264- print ( " this shouldn't happen " )
235+ case - 350 ... - 300 :
236+ checkNote ( length: length, noteToPlay: " C1 " )
237+ case - 299 ... - 250 :
238+ checkNote ( length: length, noteToPlay: " D1 " )
239+ case - 249 ... - 200 :
240+ checkNote ( length: length, noteToPlay: " E1 " )
241+ case - 199 ... - 150 :
242+ checkNote ( length: length, noteToPlay: " F1 " )
243+ case - 149 ... - 100 :
244+ checkNote ( length: length, noteToPlay: " G1 " )
245+ case - 99 ... - 50 :
246+ checkNote ( length: length, noteToPlay: " A1 " )
247+ case - 49 ... 0 :
248+ checkNote ( length: length, noteToPlay: " B1 " )
249+ case 1 ... 50 :
250+ checkNote ( length: length, noteToPlay: " C2 " )
251+ case 51 ... 100 :
252+ checkNote ( length: length, noteToPlay: " D2 " )
253+ case 101 ... 150 :
254+ checkNote ( length: length, noteToPlay: " E2 " )
255+ case 151 ... 200 :
256+ checkNote ( length: length, noteToPlay: " F2 " )
257+ case 201 ... 250 :
258+ checkNote ( length: length, noteToPlay: " G2 " )
259+ case 251 ... 300 :
260+ checkNote ( length: length, noteToPlay: " A2 " )
261+ case 301 ... 350 :
262+ checkNote ( length: length, noteToPlay: " B2 " )
263+ default :
264+ print ( " this shouldn't happen " )
265265 }
266-
267266 contact. bodyA. node!. removeFromParent ( )
268267 contact. bodyB. node!. removeFromParent ( )
269268 }
@@ -280,14 +279,15 @@ public class GameScene: SKScene, SKPhysicsContactDelegate {
280279 } else {
281280 //print("this is not a quarter or half note...")
282281 }
283-
284282 checkCorrect ( noteToCheck: noteToPlay)
285283 }
286284
287285 ////////////////
288286 //MARK:Scoring//
289287 ////////////////
290288
289+ //FIX THIS
290+
291291 var notesPlayed = 0
292292 var nextNote : String !
293293 var targetNote : String !
@@ -322,7 +322,6 @@ public class GameScene: SKScene, SKPhysicsContactDelegate {
322322
323323 public override func mouseDown( with event: NSEvent ) {
324324 shootBeam ( )
325- print ( " clicked " )
326325 }
327326
328327 ////////////////////
@@ -369,13 +368,14 @@ public class GameScene: SKScene, SKPhysicsContactDelegate {
369368 if i < ( song. songArray. count - 1 ) {
370369 if ( ( song. songArray [ i] ) . 0 ) == " N/A " {
371370 //delay here
372- DispatchQueue . main . asyncAfter ( deadline : . now ( ) + . seconds ( Int ( ( song. songArray [ i] ) . 2 ) ) ) {
371+ delay ( Double ( ( song. songArray [ i] ) . 2 ) ) {
373372 self . playSong ( )
374373 }
375374 } else {
376375 //spawn note
377376 spawnNote ( note: ( ( song. songArray [ i] ) . 0 ) , octave: ( ( song. songArray [ i] ) . 1 ) , length: ( ( song. songArray [ i] ) . 2 ) )
378- DispatchQueue . main. asyncAfter ( deadline: . now( ) + . seconds( Int ( ( song. songArray [ i] ) . 2 ) ) ) {
377+ //delay
378+ delay ( Double ( ( song. songArray [ i] ) . 2 ) ) {
379379 self . playSong ( )
380380 }
381381 }
0 commit comments