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)];