🐛 Raffiche le nombre de virus restant

This commit is contained in:
Clément 2021-01-08 16:06:35 +01:00
parent 82c150fa93
commit 80336d2efb

View File

@ -31,6 +31,9 @@ let colors = ['bleu', 'rouge', 'vert'];
function preload() { function preload() {
that = this; that = this;
this.scale.scaleMode = Phaser.Scale.ScaleManager.SHOW_ALL;
this.scale.pageAlignHorizontally = true;
this.scale.pageAlignVertically = true;
this.load.audio('shoot', [ 'sound/shoot.ogg', 'sound/shoot.mp3' ]); this.load.audio('shoot', [ 'sound/shoot.ogg', 'sound/shoot.mp3' ]);
this.load.audio('win', [ 'sound/win.ogg', 'sound/win.mp3' ]); this.load.audio('win', [ 'sound/win.ogg', 'sound/win.mp3' ]);
this.load.image('target', 'img/target.png'); this.load.image('target', 'img/target.png');
@ -59,12 +62,12 @@ function create() {
shoot = this.sound.add('shoot'); shoot = this.sound.add('shoot');
win = this.sound.add('win'); win = this.sound.add('win');
enemiesText = this.add.text(16, 16, 'virus restant : '+maxEnemies, { fontSize: '32px', fill: '#000' });
graphics = this.add.graphics(); graphics = this.add.graphics();
graphics.fillGradientStyle(0x3d6d7d, 0x3d6d7d, 0x9addf3, 0x9addf3, 1); graphics.fillGradientStyle(0x3d6d7d, 0x3d6d7d, 0x9addf3, 0x9addf3, 1);
graphics.fillRect(0, 0, width, height); graphics.fillRect(0, 0, width, height);
enemiesText = this.add.text(40, 40, 'virus restant : '+maxEnemies, { fontSize: '32px', fill: '#000' });
viruses = new Array(maxEnemies).fill(null).map( viruses = new Array(maxEnemies).fill(null).map(
function() { function() {
let color = colors[Math.floor(Math.random() * colors.length)]; let color = colors[Math.floor(Math.random() * colors.length)];