P4nch0 Posted August 18, 2015 Share Posted August 18, 2015 Hi! Is any way to know when the collision is stopped? I want after broken collision add elements in div but how to know when collision is stopped?Do You have any ideas?Thanks in advance Link to comment Share on other sites More sharing options...
P4nch0 Posted August 18, 2015 Author Share Posted August 18, 2015 i want to add buttons to div, when objects collide: this.game.physics.arcade.collide(this.player, this.eqgroup, this.wyborfunkcji, null, this); function after collidewyborfunkcji: function(player, element){ if (element.funkcja == "krzeslof"){document.getElementById('FUNCTION').innerHTML= "<center><button id='button' >krzeslo</button></center>"; document.getElementById('button').addEventListener("click", this.buttonkrzeslo, false);}function after click:buttonkrzeslo: function(){console.log("wykonano");},And this is working, but i want now delete button from div when collide stopped. I try do to it that : update: function() { if (!this.game.physics.arcade.collide(this.player, this.eqgroup, this.wyborfunkcji, null, this)){ document.getElementById('FUNCTION').innerHTML= ''; }And it is working, but my button doesnt work now. When i dont add last code, my button if working. Link to comment Share on other sites More sharing options...
Recommended Posts