I have a CCSprite "_wo1" and it has a BOOL property "attack". I have the following code in my update method and I want it to constantly check if "attack" is YES or NO and make my sprite do different kinds of runAction.
So my question is:
How to compare two runAction? I tried "==" and "isEqual" and they are not working..
MySprite *_wo1 = ... // initialize _wo1 using my own class that sub-classed CCSprite
if (![_wo1 attack])
{
_wo1.position = ccp(_wo1.position.x + 10 * dt, _wo1.position.y); // walking forward
if (currentAction == attAction) // currentAction is defined in setting its runAction in the beginning: "currentAction = [wo1 runAction:[s01WalkAction copy]];"
{
[_wo1 stopAction:attAction];
[_wo1 runAction:[walkAction copy]];
}
}
else{
if (currentAction == walkAction)
{
[_wo1 stopAction:walkAction];
[_wo1 runAction:[attAction copy]];
}
}
Any helps or suggestions will be highly appreciated. Thank you!