@@ -143,7 +143,7 @@ public class GameScene: SKScene, SKPhysicsContactDelegate {
143143 beam. physicsBody!. applyImpulse ( CGVector ( dx: 0.0 , dy: 10.0 ) )
144144 }
145145
146- public func prepareNoteForSpawn( note: String , octave : Int , length: Double ) {
146+ public func prepareNoteForSpawn( note: String , length: Double ) {
147147
148148 let noteWidth = 50.00
149149 var noteHeight : Double
@@ -224,7 +224,7 @@ public class GameScene: SKScene, SKPhysicsContactDelegate {
224224 scene. addChild ( newNote)
225225
226226 //start moving down the screen
227- let move = SKAction . moveBy ( x: 0 , y: - 1500 , duration: 15 / 3 )
227+ let move = SKAction . moveBy ( x: 0 , y: - 1500 , duration: 15 / 4 )
228228 newNote. run ( move)
229229
230230 //to maintain performance, delete note nodes after they leave the screen.
@@ -338,102 +338,75 @@ public class GameScene: SKScene, SKPhysicsContactDelegate {
338338 //this function adds all the notes to the array within the Song class
339339 public func setupSong( ) {
340340 // .quarter = .25, half = .5, and so on; fix later
341-
342- song. addNote ( note: " E " , octave: 1 , length: 0.25 )
343- song. addDelay ( length: 0.5 )
344- song. addNote ( note: " D " , octave: 1 , length: 0.25 )
345- song. addDelay ( length: 0.5 )
346- song. addNote ( note: " C " , octave: 1 , length: 0.25 )
347- song. addDelay ( length: 0.5 )
348- song. addNote ( note: " D " , octave: 1 , length: 0.25 )
349- song. addDelay ( length: 0.5 )
350- song. addNote ( note: " E " , octave: 1 , length: 0.25 )
351- song. addDelay ( length: 0.5 )
352- song. addNote ( note: " E " , octave: 1 , length: 0.5 )
353- song. addDelay ( length: 0.5 )
354- song. addNote ( note: " E " , octave: 1 , length: 0.25 )
355- song. addDelay ( length: 0.5 )
356- song. addNote ( note: " D " , octave: 1 , length: 0.25 )
357- song. addDelay ( length: 0.5 )
358- song. addNote ( note: " D " , octave: 1 , length: 0.25 )
359- song. addDelay ( length: 0.5 )
360- song. addNote ( note: " D " , octave: 1 , length: 0.25 )
361- song. addDelay ( length: 0.5 )
362- song. addNote ( note: " E " , octave: 1 , length: 0.25 )
341+ song. addNote ( note: " E " , length: 0.25 )
363342 song. addDelay ( length: 0.5 )
364- song. addNote ( note: " E " , octave : 1 , length: 0.5 )
343+ song. addNote ( note: " D " , length: 0.25 )
365344 song. addDelay ( length: 0.5 )
366- song. addNote ( note: " E " , octave : 1 , length: 0.5 )
345+ song. addNote ( note: " C " , length: 0.25 )
367346 song. addDelay ( length: 0.5 )
368-
369- song. addNote ( note: " E " , octave: 1 , length: 0.25 )
370- song. addDelay ( length: 0.5 )
371- song. addNote ( note: " D " , octave: 1 , length: 0.25 )
372- song. addDelay ( length: 0.5 )
373- song. addNote ( note: " C " , octave: 1 , length: 0.25 )
374- song. addDelay ( length: 0.5 )
375- song. addNote ( note: " D " , octave: 1 , length: 0.25 )
347+ song. addNote ( note: " D " , length: 0.25 )
376348 song. addDelay ( length: 0.5 )
377- song. addNote ( note: " E " , octave: 1 , length: 0.25 )
349+ song. addNote ( note: " E " , length: 0.25 )
350+ song. addDelay ( length: 0.25 )
351+ song. addNote ( note: " E " , length: 0.25 )
352+ song. addDelay ( length: 0.25 )
353+ song. addNote ( note: " E " , length: 0.25 )
378354 song. addDelay ( length: 0.5 )
379- song. addNote ( note: " E " , octave: 1 , length: 0.5 )
355+ song. addNote ( note: " D " , length: 0.25 )
356+ song. addDelay ( length: 0.25 )
357+ song. addNote ( note: " D " , length: 0.25 )
358+ song. addDelay ( length: 0.25 )
359+ song. addNote ( note: " D " , length: 0.25 )
380360 song. addDelay ( length: 0.5 )
381- song. addNote ( note: " E " , octave: 1 , length: 0.25 )
361+ song. addNote ( note: " E " , length: 0.25 )
362+ song. addDelay ( length: 0.25 )
363+ song. addNote ( note: " E " , length: 0.25 )
364+ song. addDelay ( length: 0.25 )
365+ song. addNote ( note: " E " , length: 0.25 )
382366 song. addDelay ( length: 0.5 )
383-
384- song. addNote ( note: " E " , octave: 1 , length: 0.25 )
385- song. addDelay ( length: 0.5 )
386- song. addNote ( note: " D " , octave: 1 , length: 0.25 )
367+ song. addNote ( note: " E " , length: 0.25 )
387368 song. addDelay ( length: 0.5 )
388- song. addNote ( note: " D " , octave : 1 , length: 0.25 )
369+ song. addNote ( note: " D " , length: 0.25 )
389370 song. addDelay ( length: 0.5 )
390- song. addNote ( note: " E " , octave : 1 , length: 0.25 )
371+ song. addNote ( note: " C " , length: 0.25 )
391372 song. addDelay ( length: 0.5 )
392- song. addNote ( note: " D " , octave : 1 , length: 0.25 )
373+ song. addNote ( note: " D " , length: 0.25 )
393374 song. addDelay ( length: 0.5 )
394- song. addNote ( note: " C " , octave: 1 , length: 0.5 )
375+ song. addNote ( note: " E " , length: 0.25 )
376+ song. addDelay ( length: 0.25 )
377+ song. addNote ( note: " E " , length: 0.25 )
378+ song. addDelay ( length: 0.25 )
379+ song. addNote ( note: " E " , length: 0.25 )
380+ song. addDelay ( length: 0.25 )
381+ song. addNote ( note: " E " , length: 0.25 )
382+ song. addDelay ( length: 0.25 )
383+ song. addNote ( note: " D " , length: 0.25 )
384+ song. addDelay ( length: 0.25 )
385+ song. addNote ( note: " D " , length: 0.25 )
386+ song. addDelay ( length: 0.25 )
387+ song. addNote ( note: " E " , length: 0.25 )
388+ song. addDelay ( length: 0.25 )
389+ song. addNote ( note: " D " , length: 0.25 )
390+ song. addDelay ( length: 0.25 )
391+ song. addNote ( note: " C " , length: 0.5 )
395392 song. addDelay ( length: 0.5 )
396-
397- /*for _ in 0...5 {
398- song.addNote(note: "A", octave: 1, length: 0.25)
399- song.addDelay(length: 0.25)
400- song.addNote(note: "C", octave: 1, length: 0.5)
401- song.addDelay(length: 0.25)
402- song.addNote(note: "D", octave: 1, length: 0.25)
403- song.addDelay(length: 0.25)
404- song.addNote(note: "E", octave: 1, length: 0.25)
405- song.addDelay(length: 0.25)
406- song.addNote(note: "F", octave: 1, length: 0.25)
407- song.addDelay(length: 0.25)
408- song.addNote(note: "A2", octave: 1, length: 0.25)
409- song.addDelay(length: 0.25)
410- song.addNote(note: "C2", octave: 1, length: 0.5)
411- song.addDelay(length: 0.25)
412- song.addNote(note: "D2", octave: 1, length: 0.25)
413- song.addDelay(length: 0.25)
414- song.addNote(note: "E2", octave: 1, length: 0.25)
415- song.addDelay(length: 0.25)
416- song.addNote(note: "F2", octave: 1, length: 0.25)
417- song.addDelay(length: 0.25)
418- }*/
419393 }
420394
421395 var i = - 1
422-
423396 //this function takes the array of notes from the Song class and prepares to spawn them into the scene
424397 public func generateSong( ) {
425398 i = i + 1
426399 if i < ( song. songArray. count ) {
427400 if ( ( song. songArray [ i] ) . 0 ) == " N/A " {
428401 //delay the next iteration by delay amount
429- delay ( Double ( ( song. songArray [ i] ) . 2 ) ) {
402+ delay ( Double ( ( song. songArray [ i] ) . 1 ) ) {
430403 self . generateSong ( )
431404 }
432405 } else {
433406 //spawn note
434- prepareNoteForSpawn ( note: ( ( song. songArray [ i] ) . 0 ) , octave : ( ( song . songArray [ i ] ) . 1 ) , length: ( ( song. songArray [ i] ) . 2 ) )
407+ prepareNoteForSpawn ( note: ( ( song. songArray [ i] ) . 0 ) , length: ( ( song. songArray [ i] ) . 1 ) )
435408 //delay the next iteration by length of not playing
436- delay ( Double ( ( song. songArray [ i] ) . 2 ) ) {
409+ delay ( Double ( ( song. songArray [ i] ) . 1 ) ) {
437410 self . generateSong ( )
438411 }
439412 }
0 commit comments