I am working on a game to determine the difference between two images.
I want to add an effect when you notice it. plotting a circle would be much better than just showing a circle all of a sudden. but I have never done basic animation or opengl before.
I don’t think that preparing 100 sprites and changing the frame of a sprite by frame is a good idea. here is my code: (just add the circle image to the left and right image.)
-(void) show {
CCSprite* leftCircle = [CCSprite spriteWithFile:@"circle.png"];
CCSprite* rightCircle = [CCSprite spriteWithFile:@"circle.png"];
leftCircle.scaleX = size.width / [leftCircle boundingBox].size.width;
leftCircle.scaleY = size.height / [leftCircle boundingBox].size.height;
rightCircle.scaleX = size.width / [rightCircle boundingBox].size.width;
rightCircle.scaleY = size.height / [rightCircle boundingBox].size.height;
leftCircle.anchorPoint = ccp(0, 1);
rightCircle.anchorPoint = ccp(0, 1);
leftCircle.position = leftPosition;
rightCircle.position = rightPosition;
[[GameScene sharedScene] addChild:leftCircle z: 3];
[[GameScene sharedScene] addChild:rightCircle z: 3];
shown = YES;
}
So how can I implement this? It would be great if you could provide some source code.
source
share