Jump to content

Problem with input and tweens


totallybueno
 Share

Recommended Posts

Hi there guys, I´m having a weird (at least for me) problem in my game...I´m gonna explain it:

 

I have a ball and I have to wait for the user to click that ball to launch a tween

 

 

This is the code I have

//ACTIVATE THE BALLthis.ball.inputEnabled = true;this.ball.events.onInputUp.addOnce(this.shootBall, this);

 and in the function

this.ball.inputEnabled = false;this.ball.events.onInputDown.remove(this.shootBall, this);var myIndex= Math.floor(Math.random()*(arrayXFakes.length-1));this.exitTween= this.game.add.tween(this.balon).to( { x:arrayXFakes[myIndex], y:arrayYFakes[myIndex] }, exitTime/2, Phaser.Easing.Linear.None).to({ y: 750 }, exitTime*2, Phaser.Easing.Linear.None).start();

The problem is that if I double click onto the sprite, I have really weird effects... with addOnce the listener is running exactly that, once, but it seems that the tween is starting twice, something really weird, actually I think that even my explanation is pretty weird...

 

Anyway, something wrong to you guys in this code?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...