mirror of
https://github.com/OpenLiberty/liberty-bikes.git
synced 2025-01-18 10:23:58 +08:00
Only load BAM sound once instead of on every death
This commit is contained in:
parent
e048675b58
commit
ee1cdd20db
@ -6,6 +6,12 @@ export class Player {
|
||||
// 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_DEAD_BITMAP = new Bitmap('../../assets/images/status_dead.png');
|
||||
static readonly BAM = new Audio('../../assets/sound/bam.wav');
|
||||
|
||||
static initialize() {
|
||||
Player.BAM.load();
|
||||
}
|
||||
Player.initialize();
|
||||
|
||||
public name: string;
|
||||
public status: string;
|
||||
@ -59,9 +65,7 @@ export class Player {
|
||||
this.image.scaleY = 1.2;
|
||||
this.image.x = this.x - 20;
|
||||
this.image.y = this.y - 20;
|
||||
var bam = new Audio('../../assets/sound/bam.wav');
|
||||
bam.load();
|
||||
bam.play();
|
||||
Player.BAM.play();
|
||||
}
|
||||
this.status = status;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user