Search the Community
Showing results for tags 'twice'.
-
Hi everyone, one of my functions is triggered twice for some reason. It is a simple click on an element. // the player stops touching the house confirmHouse(sprite, pointer) { console.log('confirmed'); // logs 2x confirmed if(MMM.candidateSprite == sprite && MMM.menuOpen == false){ var _this = this; ........ } } // function to set a single house with specific postion setOneHouse(posX, posY, id, reference){ var house = this.game.add.image(posX, posY, reference); house.id = id; house.anchor.setTo(0.5); house.inputEnabled = true; house.events.onInputDown.add(this.selectSprite, this); house.events.onInputUp.add(this.confirmHouse, this); console.log('House set'); // logs 1x house set MMM.backgroundobjects.add(house); }Is it due to the nature of the events.onInputUp function? This double execution of my confirmHouse function is causing some nasty problems. Hope you guys can help me
-
Lets say I have this code: var mySprite=this.add.sprite('mySprite'); mySprite.alpha=0; var mySpriteTween=this.add.tween(mySprite); mySpriteTween.to({alpha:1},1000,'Linear',false,0,0,true); mySpriteTween.start(); mySpriteTween.start(); When I call start() the second time the tween does not run even though I have yoyo set to true and thus the alpha of mySprite has been tweened back to zero. Does the Tween Manager clear the TweenData object owned by mySpriteTween after it has completed?