After the wizard has performed the action with Blink, it disappears because there is the possibility that the sprite is just to the transparent part, so it is best to let the Genie setvisible show up after the sprite has performed the action.
How to resolve:
Format 1
Blink * hurt = blink::create (0.5, 5);
Write a callback function and call this callback function when the Blink action is completed
Callfunc *call2 = Callfunc::create ([this] () {
This->setvisible (TRUE);
});
This->runaction (Sequence::create (Hurt,call2, NULL));
Format 2
void Hero::afterhurt ()//The hero flashes after it may be gone, here to show it back
{
This->setvisible (TRUE);
}
After you use blink, you must wait for the wizard to finish, forcing the visual value of the wizard to be true before it can appear, otherwise it may appear blank
Blink * hurt = blink::create (0.5, 5);
finitetimeaction* action1 = Ccsequence::create (Hurt, callfunc::create (this, Callfunc_selector (Hero::afterhurt)), NULL);
This->runaction (Action1);
- void //hero flashing may be missing, here to display it again   
- {
- this true
- wudi = false ;
- }
[CPP]View PlainCopy
- void hero::hurt ()
- {
- hp--;
- if (hp >= 0)
- {
- //after using Ccblink must wait for the wizard to finish, force set the visual value of the wizard is true to display, otherwise there may be blank
- ccactioninterval* action = ccblink::create (1.0f,  3);
- ccfinitetimeaction* action1 = ccsequence::create (Action, Cccallfunc::create (this ,
- callfunc_selector (Hero::afterHurt)), NULL);
- this
- }
- }
The solution to the problem that the genie disappears after using blink action in Cocos2d-x