totallybueno Posted June 13, 2014 Share Posted June 13, 2014 Hi guys,so I have this problem with one sprite... I set the inputEnabled property to true, it works, cool. Once I click on it, I disable it and at some point of the game I set it to true again, but weird thing, it´s not working. First console.log -> trueSecond console.log -> falseEverything is normal so far... but the second time that I call getBonus() the console.log, JUST AFTER the inputEnabled=true gives me false, and it´s just after the inputEnabled=true //PREVIOUS CODE...gotBonus:function(){ this.weaponIcon.alpha = 1; this.weaponIcon.inputEnabled=true; console.log("ACTIVATED = "+this.weaponIcon.inputEnabled); this.weaponIcon.events.onInputDown.add(this.initWeapon, this);}//MORE CODEinitWeapon:function(){ this.weaponIcon.alpha = 0.5; this.weaponIcon.inputEnabled=false; console.log("ACTIVATED = "+this.weaponIcon.inputEnabled); this.shoot();}Does anyone know what is happening here? Thanks in advance. Link to comment Share on other sites More sharing options...
Alvin Posted June 15, 2014 Share Posted June 15, 2014 Does it still work properly even though the console logs 'false' ? You could also use : this.weaponIcon.events.onInputDown.addOnce(this.initWeapon, this); totallybueno 1 Link to comment Share on other sites More sharing options...
totallybueno Posted June 15, 2014 Author Share Posted June 15, 2014 Hi there Alvin,it wasn´t working at all, but doing it this way works perfectly Thanks dude Link to comment Share on other sites More sharing options...
Alvin Posted June 16, 2014 Share Posted June 16, 2014 Hi Jorge, no worries dude Link to comment Share on other sites More sharing options...
Recommended Posts