1 decade ago by nightbyter
Hello to all,
i have created a sub class to display an Intro-Slideshow with music before the game starts.
The idea was to display some pictures with music in the background until the user hits the SPACE-KEY. After this, i want to bail out to the StartScreen with ig.system.setGame(StartScreen)
It works nice but i cant to stop the music.
When i call setGame the music player forever, if i take this line out, the music stops.
Can someone help me to understand please?
i have created a sub class to display an Intro-Slideshow with music before the game starts.
The idea was to display some pictures with music in the background until the user hits the SPACE-KEY. After this, i want to bail out to the StartScreen with ig.system.setGame(StartScreen)
It works nice but i cant to stop the music.
When i call setGame the music player forever, if i take this line out, the music stops.
// New Screen class for Intro story
IntroAni = ig.Game.extend({
instructText: new ig.Font( 'media/2Comic-Font_Meili.font.png' ),
Intro_bkg01: new ig.Image('media/intro/intro_01.png'),
Intro_Image01: new ig.Image('media/intro/intro_01_2.png'),
Intro_bkg02: new ig.Image('media/intro/intro_bkg2.png'),
Intro_Image02: new ig.Image('media/intro/intro_02.png'),
Intro_bkg03: new ig.Image('media/intro/intro_03.png'),
displayTime: null,
init: function( x, y, settings ) {
ig.input.bind( ig.KEY.SPACE, 'start');
this.durationTimer = new ig.Timer();
this.displayTime = 2;
ig.music.add( 'media/sounds/Funny_sunny_Island.*', "Intro" );
ig.music.loop = true;
ig.music.volume = .5;
ig.music.play("Intro");
},
update: function() {
this.parent();
if(ig.input.pressed('start')){
console.log('leaving Intro - music should stop');
ig.music.stop("Intro");
ig.system.setGame(StartScreen) //<--???
}
},
draw: function() { ........... and so on ...
Can someone help me to understand please?
