Jump to content

Tween Issue


sansa
 Share

Recommended Posts

Hello, I'm having an issue with the tween.
For example a card flip.

this.cardChoice = game.add.sprite(213, 255, 'normal_cards', 'back_card');
this.cardChoice.anchor.setTo(0.5, 0.5);
this.cardChoice.scale.setTo(0.84, 0.80);
this.cardChoice.scale.setTo(0.84, 0.80);

    public cardFlip() {
        this.tweenPCard = this.game.add.tween(this.cardChoice.scale).to( { x: 0 }, 200, 'Quart.easeOut');
        this.tweenPCard.start();
        this.tweenPCard.onComplete.add(this.choiceCardFlip, this);
    }

    public choiceCardFlip() {
        this.tweenChoice = this.game.add.tween(this.choice.scale).to( { x: 0.84 }, 200, 'Quart.easeOut');
        this.tweenChoice.start();
    }



In the first few plays the tween is good but after several plays the card is not flipping and it's like the this.tweenCard = this.game.add.tween(this.cardChoice.scale).to( { x: 0 }, 200, 'Quart.easeOut'); is disappearing.
Thanks.

Edited by sansa
Put the code in code snippet, corrected the variable
Link to comment
Share on other sites

13 hours ago, Abhishek Singhal said:

can't figure out any issue in the above code section.
can you add some reference or link , to demo the issue you are facing ?

Hello, Abhishek Singhal. :)
Please see the attached image. 
So every gameset has 5 rounds. We have this feature of autoplay so it's like looping the gameset.
For example i set the autoplay with 99 so it will loop 99 times. In first few plays(or in first few gamesets) it tweens smoothly but the longer you play this it's like the card is not flipping anymore like it is now blinking. Thank you so much. :)

Screenshot_2.jpg

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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