Commits

Dominic Kexel committed 301f5df Draft

initialize sounds lazy

  • Participants
  • Parent commits 4518070

Comments (0)

Files changed (1)

 _noise = 'Noise 004.wav'
 _kick = 'Kick 003.wav'
 
-for n in (_noise, _kick):
-  _sounds[n] = pygame.mixer.Sound(n)
+
+def __init():
+  if not _sounds:
+    for n in (_noise, _kick):
+      _sounds[n] = pygame.mixer.Sound(n)
 
 def play_kick():
+  __init()
   _sounds[_kick].play()
 
 def play_explosion():
+  __init()
   _sounds[_noise].play()