Skip to content

Commit ffa46a1

Browse files
Updated SpringRoll feature list and state listeners
1 parent a734028 commit ffa46a1

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

src/game.js

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ export class Game
99
{
1010
this.width = width;
1111
this.height = height;
12+
this.sfxVolume = 1;
13+
1214
this.app = new Application(
1315
{
1416
features:
1517
{
16-
sfx: true
18+
captions: true,
19+
sound: true,
20+
soundVolume: true,
21+
vo: true,
22+
voVolume: true,
23+
music: true,
24+
musicVolume: true,
25+
sfx: true,
26+
sfxVolume: true,
27+
1728
}
1829
});
1930

@@ -28,47 +39,44 @@ export class Game
2839
callback: this.resize
2940
});
3041

31-
// Subscribe to required springroll States.
42+
// Listen for container events from the application.
43+
// wait for the app to be ready, then set the new scene
44+
this.app.state.ready.subscribe(() =>
45+
{
46+
this.app.state.scene.value = new TitleScene(this);
47+
});
48+
3249
this.app.state.pause.subscribe((value) =>
3350
{
3451
this.isPaused = value;
3552
});
36-
53+
this.app.state.captionsMuted.subscribe(result =>
54+
{
55+
console.log('captionsMuted: ', result);
56+
});
3757
this.app.state.soundVolume.subscribe((value) =>
3858
{
39-
// set master volume
59+
// set main volume
4060
createjs.Sound.volume = value;
4161
});
42-
43-
this.sfxVolume = 1;
44-
this.app.state.sfxVolume.subscribe((value) =>
62+
this.app.state.voVolume.subscribe(result =>
4563
{
46-
this.sfxVolume = value;
64+
console.log('voVolume: ', result);
4765
});
4866
this.app.state.musicVolume.subscribe(result =>
4967
{
5068
console.log('musicVolume: ', result);
5169
});
52-
this.app.state.voVolume.subscribe(result =>
53-
{
54-
console.log('voVolume: ', result);
55-
});
56-
this.app.state.captionsMuted.subscribe(result =>
70+
this.app.state.sfxVolume.subscribe((value) =>
5771
{
58-
console.log('captionsMuted: ', result);
72+
this.sfxVolume = value;
5973
});
6074

6175
// add an extra state property for storying the current scene. Whenever the scene is changed, this class
6276
// will swap out the container attached to the stage
6377
this.app.state.scene = new Property(null);
6478
this.app.state.scene.subscribe(this.onChangeScene.bind(this));
6579

66-
// wait for the app to be ready, then set the new scene
67-
this.app.state.ready.subscribe(() =>
68-
{
69-
this.app.state.scene.value = new TitleScene(this);
70-
});
71-
7280
// Set Ticker
7381
createjs.Ticker.framerate = 60;
7482
createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED;

0 commit comments

Comments
 (0)