From 80336d2efb00704169a52822dce7f14122ed1371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Fri, 8 Jan 2021 16:06:35 +0100 Subject: [PATCH] :bug: Raffiche le nombre de virus restant --- js/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 8bb9a0d..b07c2ea 100644 --- a/js/main.js +++ b/js/main.js @@ -31,6 +31,9 @@ let colors = ['bleu', 'rouge', 'vert']; function preload() { 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('win', [ 'sound/win.ogg', 'sound/win.mp3' ]); this.load.image('target', 'img/target.png'); @@ -59,12 +62,12 @@ function create() { shoot = this.sound.add('shoot'); win = this.sound.add('win'); - enemiesText = this.add.text(16, 16, 'virus restant : '+maxEnemies, { fontSize: '32px', fill: '#000' }); - graphics = this.add.graphics(); graphics.fillGradientStyle(0x3d6d7d, 0x3d6d7d, 0x9addf3, 0x9addf3, 1); 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( function() { let color = colors[Math.floor(Math.random() * colors.length)];