var numPlanet = 0;

AFRAME.registerComponent('cursor-destroy', {
    init : function () {
        var explosion_image = document.getElementById('explosion');
        var audio = document.getElementById("audio");

        this.el.addEventListener('click', function () {

            audio.play();

            var target_position = AFRAME.utils.entity.getComponentProperty(this, 'position');
            AFRAME.utils.entity.setComponentProperty(explosion_image, 'position', target_position);
            this.setAttribute('visible', false);

            explosion_image.setAttribute('visible', true);
            explosion_image.emit('BANG');

            numPlanet = numPlanet || document.querySelectorAll('.planet').length;
            numPlanet--;

            document.getElementById("remaining").innerHTML = numPlanet;

            if(numPlanet === 0){
                document.getElementById("win-message").style.display = 'block';
                console.log('0 planet');
            }
        });
    }
});

var button = document.getElementById("wasd");
button.addEventListener("click",function(){
    var audio = document.getElementById("audio");
    audio.play();
});

document.addEventListener("DOMContentLoaded", function () {
    var totalPlanet = document.querySelectorAll('.planet').length;
    document.getElementById("total").innerHTML = totalPlanet;

    var timePeriodInMs = 4000;

    setTimeout(function () {
            document.getElementById("wasd").style.display = "none";
        },
        timePeriodInMs);
});



@@ -274,16 +274,19 @@
         
+ //
  audio.p
@@ -1011,16 +1011,17 @@
  %7D%0A%7D);%0A%0A
+%0A
 var butt
@@ -1062,40 +1062,26 @@
 %22);%0A
+%0A
 button.
-addEventListener(%22
+on
 click
-%22,
+ = 
 func
@@ -1086,16 +1086,17 @@
 nction()
+ 
 %7B%0A    va
@@ -1158,18 +1158,18 @@
 lay();%0A%7D
-)
 ;
+%0A
 %0A%0Adocume

add play button for sound on mobile device