1
0
Fork 0

Added some sound effects

This commit is contained in:
Michaël Lemaire 2017-05-17 18:21:14 +02:00
parent 769c539d8a
commit 4ccaf59978
14 changed files with 30 additions and 6 deletions

View file

@ -24,11 +24,12 @@ After making changes to sources, you need to recompile:
## Credits
* **[Michaël Lemaire](https://thunderk.net/)** - Code and graphics
* **[Matthieu Desprez](https://github.com/edistra)** - Beta testing and ideas
* **[Phaser](http://phaser.io)** - Game engine
* **[Viktor Hahn](https://opengameart.org/content/spaceships-6)** - Ship models
* This work, made by Viktor Hahn (Viktor.Hahn@web.de), is licensed under the Creative Commons Attribution 3.0 Unported License. http://creativecommons.org/licenses/by/3.0/
* **[www.kenney.nl](www.kenney.nl)** - Sound effects
* **[Matthieu Desprez](https://github.com/edistra)** - Beta testing and ideas
* **Nicolas Forgo** - Ship models
* **[Phaser](http://phaser.io)** - Game engine
* **[Kevin MacLeod](http://www.incompetech.com/)** - Musics
* "Full On" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0 License

1
TODO
View file

@ -29,7 +29,6 @@
* Drones: add hull points and take area damage
* Drones: find a way to avoid arena cluttering
* Show power usage/recovery in action bar, on action hover
* More sound effects (but battle sounds should be vibration only, we are in space !)
* Add a battle log display
* Organize arena objects and information in layers
* Prevent arena effects information (eg. "shield -36") to overflow out of the arena

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -119,6 +119,11 @@ module TS.SpaceTac.UI {
// Load sounds
this.loadSound("battle/ship-change.wav");
this.loadSound("battle/weapon-bullets.wav");
this.loadSound("battle/weapon-missile-launch.wav");
this.loadSound("battle/weapon-missile-explosion.wav");
this.loadSound("battle/drone-deploy.wav");
this.loadSound("battle/drone-destroy.wav");
this.loadSound("battle/drone-activate.wav");
// Load musics
this.loadSound("music/walking-along.mp3");

View file

@ -148,8 +148,6 @@ module TS.SpaceTac.UI {
}
this.playing = arena_ship;
}
this.battleview.gameui.audio.playOnce("battle-ship-change");
}
/**

View file

@ -126,15 +126,18 @@ module TS.SpaceTac.UI {
if (this.battle.canPlay(this.view.player)) {
// Player turn
this.view.gameui.audio.playOnce("battle-ship-change");
this.view.setInteractionEnabled(true);
} else {
this.view.setInteractionEnabled(false);
if (event.new_ship.isAbleToPlay()) {
// AI turn
this.view.gameui.audio.playOnce("battle-ship-change");
this.battle.playAI();
this.delayNextEvents(1500);
} else {
// Ship unable to play, skip turn
this.view.timer.schedule(event.new_ship.alive ? 2000 : 500, () => {
this.view.timer.schedule(event.new_ship.alive ? 2000 : 200, () => {
this.battle.advanceToNextShip();
});
}
@ -206,12 +209,21 @@ module TS.SpaceTac.UI {
// New drone deployed
private processDroneDeployedEvent(event: DroneDeployedEvent): void {
let duration = this.view.arena.addDrone(event.drone, !event.initial);
if (duration) {
this.view.gameui.audio.playOnce("battle-drone-deploy");
}
this.delayNextEvents(duration);
}
// Drone destroyed
private processDroneDestroyedEvent(event: DroneDestroyedEvent): void {
this.view.arena.removeDrone(event.drone);
if (!event.initial) {
this.view.gameui.audio.playOnce("battle-drone-destroy");
this.delayNextEvents(1000);
}
}
// Drone applied
@ -219,6 +231,11 @@ module TS.SpaceTac.UI {
let drone = this.view.arena.findDrone(event.drone);
if (drone) {
let duration = drone.setApplied();
if (duration) {
this.view.gameui.audio.playOnce("battle-drone-activate");
}
this.delayNextEvents(duration);
}
}

View file

@ -128,6 +128,8 @@ module TS.SpaceTac.UI {
* Default firing effect
*/
defaultEffect(): number {
this.ui.audio.playOnce("battle-weapon-missile-launch");
let missile = new Phaser.Image(this.ui, this.source.x, this.source.y, "battle-weapon-default");
missile.anchor.set(0.5, 0.5);
missile.rotation = this.source.getAngleTo(this.destination);
@ -140,6 +142,8 @@ module TS.SpaceTac.UI {
tween.onComplete.addOnce(() => {
missile.destroy();
if (blast_radius > 0) {
this.ui.audio.playOnce("battle-weapon-missile-explosion");
let blast = new Phaser.Image(this.ui, this.destination.x, this.destination.y, "battle-weapon-blast");
let scaling = blast_radius * 2 / (blast.width * 0.9);
blast.anchor.set(0.5, 0.5);