Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5957413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:23:49+00:00 2026-05-22T18:23:49+00:00

i am working on a game to spot the difference between 2 images. I

  • 0

i am working on a game to spot the difference between 2 images.

I want to add an effect when you spot it. drawing out a circle would be much better than just showing the circle suddenly. but i’ve never done core animation or opengl before.

i don’t think preparing 100 sprites and changing the sprite frame by frame is a good idea.
here is my code: (just add a circle image to both 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 it? It would be great if you can provide some source code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:23:50+00:00Added an answer on May 22, 2026 at 6:23 pm

    As a simple way i can recommend you to create a circle and put it’s scale to zero. Then create a CCScale action and run it. It will give you a growing circle. Here is the code:

    CCSprite *sprite = [CCSprite spriteWithFile:@"mySprite.png"];
    [sprite setScale:0.01];
    id scale = [CCScale actionWithDuration:0.3 scale:1];
    [sprite runAction:scale];
    

    The other action can be used is CCFadeIn.You can make your sprite invisible after creation and make it fade in:

    CCSprite *sprite = [CCSprite spriteWithFile:@"mySprite.png"];
    [sprite setOpacity:0];
    id fade = [CCFadeIn actionWithDuration:0.3];
    [sprite runAction:fade];
    

    Also you can combine this actions:

    [sprite runAction:fade];
    [sprite runAction:scale];
    

    Also you can make it big (set scale 3 for example) and transparent. And make it fade in and scale down to highlight your image

    To Draw a circle via drawing effect you can make it from small parts (arcs) and then build your circle from them. I think it also will be cool if you make don’t make the part visible when adding, but make it fade in. I mean something like this:

    -(void) init
    {
        NSMutableArray *parts = [[NSMutableArray array] retain]; //store it in your class variable
        parts_ = parts;
        localTime_ = 0; //float localTime_ - store the local time in your layer
        //create all the parts here, make them invisible and add to the layer and parts
    }
    
    -(void) update: (CCTime) dt //add update method to your layer that will be called every simulation step
    {
        localTime_ += dt;
    
        const float fadeTime = 0.1;
        int currentPart = localTime_ / fadeTime;
    
        int i = 0;
        for (CCSprite *part in parts)
        {
            //setup the opacity of each part according to localTime
            if (i < currentPart) [part setOpacity:255];
            else if (i == currentPart)
            {
                float localLocalTime = localTime - i*fadeTime;
                float alpha = localLocalTime / fadeTime;
                [part setOpacity:alpha];
            }
            ++i;
        } 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on game. I want to highlight a spot on the screen
I've been working on a game engine for awhile. I've started out with 2D
I am working on a game. I want to do something like 50% of
I'm working on a touch based game, and I'm having issues drawing a path
Working on a game project that involves a scripting language that I want to
I am working on a game in which I want a movie clip to
I'm working on a tower defense game and I want the defending turrets to
I am working on a game in Javascript, and I would like to be
I am working on a game where I want to create shadows under a
Working on a game, and I was testing out my renderer. It unfortunately only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.