mirror of
https://github.com/OpenLiberty/liberty-bikes.git
synced 2025-01-18 10:23:58 +08:00
commit
6485bf9b16
@ -5,6 +5,7 @@ export class Player {
|
|||||||
// According to EaselJS, "When a string path or image tag that is not yet loaded is used, the stage may need to be redrawn before the Bitmap will be displayed."
|
// According to EaselJS, "When a string path or image tag that is not yet loaded is used, the stage may need to be redrawn before the Bitmap will be displayed."
|
||||||
// For this reason, we need to pre-load an instance of the image (this copy never gets used)
|
// For this reason, we need to pre-load an instance of the image (this copy never gets used)
|
||||||
static readonly PLAYER_BITMAP = new Bitmap('../../assets/images/bike_wide.png');
|
static readonly PLAYER_BITMAP = new Bitmap('../../assets/images/bike_wide.png');
|
||||||
|
static readonly PLAYER_DEAD_BITMAP = new Bitmap('../../assets/images/status_dead.png');
|
||||||
|
|
||||||
public name: string;
|
public name: string;
|
||||||
public status: string;
|
public status: string;
|
||||||
@ -49,6 +50,17 @@ export class Player {
|
|||||||
this.tooltip.visible(isVisible);
|
this.tooltip.visible(isVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setStatus(status: string) {
|
||||||
|
this.status = status;
|
||||||
|
if (status === 'Dead') {
|
||||||
|
this.image = new Bitmap('../../assets/images/status_dead.png');
|
||||||
|
this.image.scaleX = 0.7;
|
||||||
|
this.image.scaleY = 0.7;
|
||||||
|
this.image.x = this.x - 10;
|
||||||
|
this.image.y = this.y - 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public addTo(stage: Stage) {
|
public addTo(stage: Stage) {
|
||||||
if (this.tooltip) {
|
if (this.tooltip) {
|
||||||
stage.addChild(this.tooltip.shape);
|
stage.addChild(this.tooltip.shape);
|
||||||
|
@ -142,7 +142,7 @@ export class GameComponent implements OnInit, OnDestroy {
|
|||||||
playerEntity.tooltip.alpha(1);
|
playerEntity.tooltip.alpha(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
playerEntity.status = player.status;
|
playerEntity.setStatus(player.status);
|
||||||
});
|
});
|
||||||
if (noneAlive) {
|
if (noneAlive) {
|
||||||
this.players.forEach((player: Player, id: string) => {
|
this.players.forEach((player: Player, id: string) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user