2016-05-13 2 views
-4

3秒後にテキストにフェードアウトエフェクトを適用する必要があります。次のリンクには例が含まれています:3秒後にテキストをフェードする

http://www.html5gamedevs.com/topic/8639-fade-out-text-after-2-second-delay/ 

しかし、動作しませんでした。

テキストである機能:

buyitems_lettuce: function() 
{ 
    if(this.pet.customParams.coin >= 60) 
    { 
     this.pet.customParams.coin -= 60; 
     this.refreshStats(); 
    } 
    else 
    { 
     var buyitemsText = {font: "bold 16pt Arial", fill: "#fff"}; 
      buyitemsText.stroke = "#A4CED9"; 
      buyitemsText.strokeThickness = 5; 

     this.PriceLettuceBuyItems = this.game.add.text(70,100, "No coin for buy Lettuce", buyitemsText); 

    } 

}, 

答えて

1
buyitems_lettuce: function() { 
    if (this.pet.customParams.coin >= 60) { 
     this.pet.customParams.coin -= 60; 
     this.refreshStats(); 
    } 
    else { 
     var buyitemsText = {font: "bold 16pt Arial", fill: "#fff"}; 
     buyitemsText.stroke = "#A4CED9"; 
     buyitemsText.strokeThickness = 5; 

     this.PriceLettuceBuyItems = this.game.add.text(70, 100, "No coin for buy Lettuce", buyitemsText); 

     this.game.add.tween(this.PriceLettuceBuyItems) 
       .to({alpha: 0}, 1000, Phaser.Easing.Default, true, 3000) 
       .onComplete.add(function() { 
         console.log("This is called when the tween is done."); 
        }, this 
       ); 
    } 
} 

これはそれを行う必要があります。

関連する問題