1
0
Fork 0

More work on immersion

This commit is contained in:
Michaël Lemaire 2017-06-07 19:08:53 +02:00
parent 896265e102
commit 08a1946c1f
7 changed files with 28 additions and 14 deletions

View file

@ -108,7 +108,7 @@ module TS.SpaceTac.UI {
this.displayFightMessage();
// BGM
this.gameui.audio.startMusic("mechanolith");
this.gameui.audio.startMusic("mechanolith", 0.3);
// Key mapping
this.inputs.bind("t", "Show tactical view", () => this.toggle_tactical_mode.switch(3000));

View file

@ -245,7 +245,9 @@ module TS.SpaceTac.UI {
private processShipChangeEvent(event: ShipChangeEvent): void {
this.view.arena.setShipPlaying(event.new_ship);
this.view.ship_list.setPlaying(event.new_ship);
this.view.gameui.audio.playOnce("battle-ship-change");
if (event.ship !== event.new_ship) {
this.view.gameui.audio.playOnce("battle-ship-change");
}
}
// Damage to ship

View file

@ -24,14 +24,14 @@ module TS.SpaceTac.UI {
}
// Start a background music
startMusic(key: string): void {
startMusic(key: string, volume = 1): void {
key = "music-" + key;
if (this.isActive()) {
if (this.music && this.music.key !== key) {
this.stopMusic();
}
if (!this.music) {
this.music = this.game.sound.play(key, 1, true);
this.music = this.game.sound.play(key, volume, true);
}
}
}

View file

@ -87,8 +87,10 @@ module TS.SpaceTac.UI {
}
obj.onInputOver.add(() => {
cursorinside = true;
enternext = Timer.global.schedule(hovertime, effectiveenter);
if (obj.visible && obj.alpha) {
cursorinside = true;
enternext = Timer.global.schedule(hovertime, effectiveenter);
}
});
obj.onInputOut.add(() => {
@ -97,9 +99,11 @@ module TS.SpaceTac.UI {
});
obj.onInputDown.add(() => {
holdstart = new Date();
if (!cursorinside && !enternext) {
enternext = Timer.global.schedule(holdtime, effectiveenter);
if (obj.visible && obj.alpha) {
holdstart = new Date();
if (!cursorinside && !enternext) {
enternext = Timer.global.schedule(holdtime, effectiveenter);
}
}
});

View file

@ -122,8 +122,8 @@ module TS.SpaceTac.UI {
new ParticleConfig(ParticleShape.FLARE, ParticleColor.CYAN, 10, 0.2, -45)
]);
fleet.position.set(this.view.getMidWidth(), this.view.getMidHeight());
this.view.game.add.tween(fleet).from({ x: fleet.x + 1500, y: fleet.y - 750 }, 3000, Phaser.Easing.Circular.Out, true);
this.view.game.add.tween(fleet).to({ alpha: 0, width: 40, height: 40 }, 500, Phaser.Easing.Cubic.Out, true, 2000);
this.view.game.add.tween(fleet).from({ x: fleet.x + 1500, y: fleet.y - 750 }, 5000, Phaser.Easing.Circular.Out, true);
this.view.game.add.tween(fleet).to({ alpha: 0, width: 40, height: 40 }, 500, Phaser.Easing.Cubic.Out, true, 3500);
let flash = this.view.game.add.image(this.view.getMidWidth() + 60, this.view.getMidHeight() - 30, "common-particles", 15);
flash.anchor.set(0.5);
flash.scale.set(0.1);
@ -132,7 +132,7 @@ module TS.SpaceTac.UI {
subflash.anchor.set(0.5);
subflash.scale.set(0.5);
flash.addChild(subflash);
this.view.game.add.tween(flash).to({ alpha: 0.7, width: 60, height: 60 }, 300, Phaser.Easing.Quadratic.Out, true, 2000, undefined, true);
this.view.game.add.tween(flash).to({ alpha: 0.7, width: 60, height: 60 }, 300, Phaser.Easing.Quadratic.Out, true, 3500, undefined, true);
}
}

View file

@ -17,7 +17,6 @@ module TS.SpaceTac.UI {
this.layer_stars = this.addLayer("stars");
this.layer_title = this.addLayer("title");
this.layer_title.x = 5000;
// Stars
for (let i = 0; i < 300; i++) {
@ -51,7 +50,16 @@ module TS.SpaceTac.UI {
this.dialog_load_game.moveToLayer(this.layer_title);
this.dialog_load_game.setVisible(false);
this.tweens.create(this.layer_title).to({ x: 0 }, 3000, Phaser.Easing.Circular.Out).start();
// Fading in
this.tweens.create(this.layer_stars).from({ alpha: 0 }, 5000).start();
this.layer_title.visible = false;
let fading = this.timer.schedule(5000, () => {
this.animations.show(this.layer_title, 1000);
})
this.input.onTap.addOnce(() => {
this.timer.cancel(fading);
this.animations.show(this.layer_title, 0);
});
this.gameui.audio.startMusic("supernatural");
}