utils.js 376 B

12345678910111213
  1. exports.playMusic = function(soundFile) {
  2. var game = Atomic.game;
  3. var musicFile = game.cache.getResource("Sound", soundFile);
  4. musicFile.looped = true;
  5. var musicNode = game.scene.createChild("MusicNode");
  6. var musicSource = musicNode.createComponent("SoundSource");
  7. musicSource.gain = .5;
  8. musicSource.soundType = Atomic.SOUND_MUSIC;
  9. musicSource.play(musicFile);
  10. };