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

  • SEARCH
  • Home
  • 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 8019997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:33:51+00:00 2026-06-04T21:33:51+00:00

I’m new to using CCAnimations in cocos2D, and I’ve run into a problem that

  • 0

I’m new to using CCAnimations in cocos2D, and I’ve run into a problem that I’ve had a hard time solving.

I’m making a basic platforming game, and the player sprite has various animations that need to be run depending on the state of the player.

I have the following code in my layer’s init method:

sprite = [CCSprite spriteWithSpriteFrameName:@"stand.png"];

standingSprites = [NSArray arrayWithObjects:
                   [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"stand.png"],
                   nil];
runningSprites = [NSArray arrayWithObjects:
                   [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"run1.png"],
                   [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"run2.png"],
                   nil];

standingAnimation = [CCAnimation animationWithFrames:standingSprites delay:0.2f];
runningAnimation = [CCAnimation animationWithFrames:runningSprites delay:0.2f];
animationAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:standingAnimation]];
[sprite runAction:animationAction];

This works as expected with either of the two animations. However, I want to run standingAnimation when the player is standing still and runningAnimation when the player is running. I attempted to do this as follows:

-(void)walk {

    if(!isWalking) {
        isWalking = true;
        [sprite stopAction:animationAction];
        animationAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:runningAnimation]];
        [sprite runAction:animationAction];
    }
}

The second to the last line crashes the program, causing an EXC_BAD_ACCESS (on referencing 0x0). Stepping through walk in the debugger, it doesn’t appear that any of the relevant pointers are null.

From the stack trace:

2012-06-03 10:59:59.907 ThirtyMinutes[9876:6403] *** Terminating app 
due to uncaught exception 'NSInvalidArgumentException', reason: 
'-[NSCTFontDescriptor frames]: unrecognized selector sent to instance 
0x7f808d93e9f0'

0x7f808d93e9f0 is the address of runningAnimation.

  1. What am I doing wrong?
  2. Is there a better way of doing this?

Thanks!

  • 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-06-04T21:33:52+00:00Added an answer on June 4, 2026 at 9:33 pm

    The error message is telling you that, at the moment of the error, 0x7f808d93e9f0 is the address of a NSCTFontDescriptor object. The likely reason is that you’re not retaining runningAnimation and its memory has been reclaimed for a different object.

    (Show the declaration of runningAnimation if its not obvious how that’s happening.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I'm making a simple page using Google Maps API 3. My first. One marker
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.