Browse Source

🐛 Raffiche le nombre de virus restant

main
Clément 11 months ago
parent
commit
80336d2efb
  1. 7
      js/main.js

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

Loading…
Cancel
Save