1
0
Fork 0

Fixed ship rotation animation

This commit is contained in:
Michaël Lemaire 2017-06-07 19:09:06 +02:00
parent 08a1946c1f
commit ba4cda168a
2 changed files with 8 additions and 1 deletions

View file

@ -40,6 +40,12 @@ module TS.SpaceTac.Specs {
ship.moveTo(70, 50);
expect(battle.log.events).toEqual([new MoveEvent(ship, new ArenaLocationAngle(50, 50, Math.PI), new ArenaLocationAngle(70, 50, 0))]);
ship.rotate(2.1);
expect(battle.log.events).toEqual([
new MoveEvent(ship, new ArenaLocationAngle(50, 50, Math.PI), new ArenaLocationAngle(70, 50, 0)),
new MoveEvent(ship, new ArenaLocationAngle(70, 50, 0), new ArenaLocationAngle(70, 50, 2.1))
]);
});
it("applies equipment cooldown", function () {

View file

@ -430,10 +430,11 @@ module TS.SpaceTac {
*/
rotate(angle: number, log = true) {
if (angle != this.arena_angle) {
let start = copy(this.location);
this.setArenaFacingAngle(angle);
if (log) {
this.addBattleEvent(new MoveEvent(this, copy(this.location), new ArenaLocationAngle(this.arena_x, this.arena_y, angle)));
this.addBattleEvent(new MoveEvent(this, start, copy(this.location)));
}
}
}