Okey, I tried what you told me. Here is it :
if (canLaunchTheAnimation) {
if (CGRectIntersectsRect([perso boundingBox], [parfum boundingBox])) {
score = score+40;
// Unlock le succès SMELLS GOOD
[OFAchievementService unlockAchievement:SMELLS_GOOD__];
// Lance le fondu
[parfum runAction:[CCSequence actions:actionPeutPasLancer,bothActions, actionMoveDone,actionPeutLancer, nil]];
}
}
The problem is that the CGRectIntersect is called each time the character touches the object. And so first the BOOL canLaunchTheAnimation is equal to YES. Then, the character touches the object and the BOOL becomes NO. Then if the character stays on the object it will relaucnh the action of CGRectIntersect, and it will not be able to finish the animation and even less able to put canLaunchTheAnimation to YES because canLaunchTheAnimation will be equal to NO and so the runAction method will not be called because of the condition
if (canLaunchTheAnimation) {
. I hope you understood this ?
So I know where do my problem come from, it's because of the CGRectIntersect method. Is it possible to tell to my CGRectIntersect method to be executed just one time, just at the first contact between the character and the object (in this case, parfum) ? Thanks in advance for your help !