Cocos 2.0 - How to blink a sprite?


#1

Cocos 2.0 - How to blink a sprite?

Hi, i follow some tutorials, but my sprite doenst blink. Or it is always visible, or it is hidden.

How i can do my sprite blink for 5 seconds?


#2

CCActionInterval* action1 = CCBlink::actionWithDuration(2, 10); ?


#3

I try it, but the player is invisible when i do it:

void Player::blink()
{
//CCBlink blink = CCBlink::actionWithDuration;
CCActionInterval
action1 = CCBlink::actionWithDuration(2, 10);
runAction(action1);
}


#4

CCActionInterval* action1 = CCBlink::actionWithDuration(2, 10);

won’t let me compile without the *, maybe thats the problem, what environment are you developing from?


#5

It has the “*”, but the editor remove


#6

anyone, i think it doesnt works :frowning:


#7

Hi.

This is not working.

Can anyone help me?


#8

post your complete code?

or reproduce this bug with a simple helloworld


#9

This is the code:

void Player::blink() {
CCActionInterval action1 = CCBlink::actionWithDuration(2, 10);
runAction(action1);
}

or

void Player::blink() {
CCBlink blink = CCBlink::actionWithDuration(3, 9);
runAction(blink);
}

Player is a class that inherit from CCSprite


#10

At same time might be there is some action already running on the code.