Add drone destroy animation
This commit is contained in:
parent
5d4315f1ca
commit
17b51bf4e0
4
TODO
4
TODO
|
@ -40,13 +40,15 @@
|
|||
* AI: evaluate based on simulated list of effects
|
||||
* Map: remove jump links that cross the radius of other systems
|
||||
* Map: disable interaction (zoom, selection) while moving/jumping
|
||||
* Add ship personality (with icons to identify ?)
|
||||
* Add ship personality (with icons to identify ?), with reaction to battle and map movements
|
||||
* Add factions and reputation
|
||||
* Tutorial
|
||||
* Missions/quests system
|
||||
* Main story arc
|
||||
|
||||
Later, if possible:
|
||||
* Animated arena background, instead of big picture
|
||||
* Dynamic music composition
|
||||
* Replays
|
||||
* Multiplayer
|
||||
* Formation or deployment phase
|
||||
|
|
|
@ -190,12 +190,14 @@ module TS.SpaceTac.UI {
|
|||
}
|
||||
}
|
||||
|
||||
// Remove a destroyed drone
|
||||
/**
|
||||
* Remove a destroyed drone
|
||||
*/
|
||||
removeDrone(drone: Drone): void {
|
||||
let sprite = this.findDrone(drone);
|
||||
if (sprite) {
|
||||
remove(this.drone_sprites, sprite);
|
||||
sprite.destroy();
|
||||
sprite.setDestroyed();
|
||||
} else {
|
||||
console.error("Drone not found in arena for removal", drone);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ module TS.SpaceTac.UI {
|
|||
|
||||
// Activation effect
|
||||
activation: Phaser.Graphics;
|
||||
|
||||
// Destroyed state
|
||||
destroyed = false;
|
||||
|
||||
constructor(battleview: BattleView, drone: Drone) {
|
||||
super(battleview.game);
|
||||
|
@ -52,6 +55,10 @@ module TS.SpaceTac.UI {
|
|||
* Return the animation duration
|
||||
*/
|
||||
setApplied(): number {
|
||||
if (this.destroyed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
this.activation.scale.set(0.001, 0.001);
|
||||
this.activation.visible = true;
|
||||
let tween = this.game.tweens.create(this.activation.scale).to({ x: 1, y: 1 }, 500);
|
||||
|
@ -59,5 +66,21 @@ module TS.SpaceTac.UI {
|
|||
tween.start();
|
||||
return 500;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sprite as destroyed
|
||||
*/
|
||||
setDestroyed() {
|
||||
this.destroyed = true;
|
||||
|
||||
this.game.tweens.create(this).to({ alpha: 0.3 }, 300).delay(200).start();
|
||||
|
||||
let tween = this.game.tweens.create(this.radius.scale).to({ x: 0, y: 0 }, 500);
|
||||
tween.onComplete.addOnce(() => {
|
||||
this.radius.destroy();
|
||||
this.activation.destroy();
|
||||
});
|
||||
tween.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue