Quantcast
Channel: 2D Latest Topics
Viewing all articles
Browse latest Browse all 623

Don't loop sound + sandbox problem ?

$
0
0

Hello & Thanks ,
I'm having 3 probs (code below) : 
1) WHen running code in Brackets , it runs fine , except that it keeps playing .mp3 over and over , inspite of 'loop = false' . But it doesn't work online : 
http://liesandcowpies.com/testMe/vm-phaser/vm-play-music-WEB.html
 2) Also , the sound volume '.5' doesn't work either . ?
3) Also , if I don't have  ' cowMoo.play(); '  in Create section , I get no sound at all ? 
4) I am also having trouble with ' http://phaser.io/sandbox/BddwLiWp/play  ' .
After I create code , and then SAVE it , and try to play it , everything disappears . 
I get the address ' http://phaser.io/sandbox/BddwLiWp/  '  but there is nothing there .
THanks

var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'vm-play-music', { preload: preload, create: create, update: update});
// http://liesandcowpies.com/testMe/vm-phaser/vm-play-cowMoo-WEB.html
var s;
var cowMoo;
var onceThru =1;
function preload() {
   game.load.baseURL = 'http://liesandcowpies.com/testMe/vm-phaser/';
    game.load.crossOrigin = 'anonymous';
    game.load.audio('cowmoo', 'CowMoo.mp3');
}
function create() {
    cowMoo = game.sound.add('cowmoo', .5,'false');
    cowMoo.play();
}
function update() {

    if (onceThru == 1)
    {
        alert('function update()   ' + onceThru);
        collisionLies02(); 
        onceThru = onceThru + 1 ;
    }
}

function collisionLies02() {
    onceThru = onceThru + 1;        
    alert('function collisionLies02() , onceThru =   ' + onceThru);
//    cowMoo = game.sound.add('cowmoo', .5,'false');
    cowMoo.play();
} 


 


Viewing all articles
Browse latest Browse all 623

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>