cocossharp

Show CCLabel for few seconds on touch


I'm new to Cocos Sharp and have been struggling to implement behaviour from question title. I want to show message to user that will fade or disappear after some period of time, lats say 3 seconds, after user touches some sprite. But I can't figure it out how to do that.

I'm showing CCLabel like this:

var scoreLabel = new CCLabel("Touch Menu and Exit button together to exit!", "Arial", 50, CCLabelFormat.SystemFont);
scoreLabel.PositionX = button.PositionX;
scoreLabel.PositionY = button.PositionY + 300;
scoreLabel.AnchorPoint = CCPoint.AnchorMiddleRight;

Can someone help me?


Solution

  • After 3 seconds, fadeout in 1 second

    scoreLabel.RunActions(new CCDelayTime(3), new CCFadeOut(1));