Game Development Reference
In-Depth Information
[SKAction rotateByAngle:degreeToRadian(3.0f)
duration:0.2]]];
[touchedNode runAction:[SKAction
repeatActionForever:sequence]];
} else {
[self.ant removeAllActions];
}
}
Now if you observe closely, you can see that we have added an
if-else
condition to
check whether the touch is made on the ant, which allows it to animate; when the touch is
made anywhere outside the screen, stop all the actions. To stop all the actions on the
sprite, we can use the
removeAllActions
method on the sprite.