Skip to content

Commit

Permalink
fix: handling the ship
Browse files Browse the repository at this point in the history
  • Loading branch information
rengert committed Feb 2, 2024
1 parent d38a1c6 commit dae779c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/app/services/game-ship.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ShipType } from '../models/pixijs/ship-type.enum';
import { ApplicationService } from './application.service';
import { ExplosionService } from './explosion.service';
import { GameShotService } from './game-shot.service';
import { ObjectService } from './object.service';
import { UpdatableService } from './updatable.service';

@Injectable()
Expand All @@ -17,6 +18,7 @@ export class GameShipService extends UpdatableService {
private readonly application: ApplicationService,
private readonly explosionService: ExplosionService,
private readonly gameShot: GameShotService,
private readonly object: ObjectService,
) {
super();
}
Expand Down Expand Up @@ -44,6 +46,7 @@ export class GameShipService extends UpdatableService {
this.#ship.play();
this.#ship.x = Math.floor(this.application.screen.width / 2);
this.#ship.y = this.application.screen.height - 100;
this.object.add(this.#ship);
this.application.stage.addChild(this.#ship);
}

Expand Down
4 changes: 1 addition & 3 deletions src/app/services/game.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,10 @@ export class GameService {
}

this.updatables.forEach(updatable => updatable.update(delta, this.level()));



if (this.ship.instance.energy === 0) {
void this.storage.setHighscore(this.kills(), this.level());
void this.presentPopup(YouAreDeadPopup);
this.ship.instance.destroy();
this.started.set(false);
}
});
Expand Down

0 comments on commit dae779c

Please sign in to comment.