Question

I want to use a blink effect in some sprites (these sprites represent land pieces). I though doing it by using a blink animation (with CCBlink). But the problem is that I would need to know when the sprite image is being shown and when it is not because if my character steps on the land piece and the sprite image is not being shown, my character is supposed to die (it falls).

So, is there any way to know if the image frame is being shown in a CCBlink animation? Or I have to simulate the blink action manually?

Thank you in advance

Was it helpful?

Solution

CCBlink works by toggling the visible property of your CCSprite back and forth for a number of times.

Therefore, I think you can check if your character is standing on a currently visible sprite simply by checking the visible property of that sprite (perhaps in your game update loop):

if (playerStandingOnLandPiece && !landPiece.visible)
{
    // player is dead.
} 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top