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 8928467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:26:35+00:00 2026-06-15T08:26:35+00:00

So I am trying to do a levelup screen with pushscene/popscene. The pushscene works

  • 0

So I am trying to do a levelup screen with pushscene/popscene. The pushscene works when it’s a blank scene, but not when it’s my scene that I want. My scene/layer loads completely with all images and text displaying their exact correct content. After all of the images load there is a EXC BAD ACCESS that doesn’t seem to be linked to any particular message being sent. Any help or further diagnostic tests would be appreciated.

I have a version where I commented out the sprites and labels and it still crashes. Is there something big that I’m missing?

EDIT: I’ve added the [self = [super init]] and [super onEnter] methods and still same problem. It’s something else. Any ideas?

EDITEDIT: I think this has something to do with the optionsArray I’m using, not sure what objects need to be retained. The array is a CCArray and contains NSDictionaries of differing capacities

#import "LevelupLayer.h"
#import "GameManager.h"
@implementation LevelupLayer
@synthesize optionsArray,spritesArray;
@synthesize confirmLabel;
@synthesize counter;

 +(id) scene {
    CCScene *scene = [CCScene node];
    CCLayer* layer = [LevelupLayer node];
    [scene addChild:layer];

    return scene;
}

-(void)onEnter
{

counter = 1; // for debugging
//Detemine what levelups are possible
GameManager* gm = [GameManager sharedManager]; //GameManager is a helper that oversees communication between layers and plists
optionsArray = [gm possibleLevelups]; //Access plist and formats data into expected format
[optionsArray retain];
int numPossibilities = [optionsArray count];

//Build Levelup layer based on possible options
CGSize size = [[CCDirector sharedDirector] winSize];
//float positionIncrement = (size.width / numPossibilities) - ((size.width/numPossibilities) * 0.5);
float positionIncrement = (size.width / numPossibilities);
float stripWidth = size.width / numPossibilities;

for (int i = 0; i < numPossibilities; i++) {
    int slot = i+1;
    NSDictionary* optionDict = [optionsArray objectAtIndex:i];
    NSString* name = [optionDict objectForKey:@"name"];
    NSString* title = [optionDict objectForKey:@"title"];
    NSString* description = [optionDict objectForKey:@"description"];


    // Add the sprite
    CCSprite* optionSpite = [CCSprite spriteWithSpriteFrameName:[NSString stringWithFormat:@"%@.png",name]];
    [self addChild:optionSpite];
    [spritesArray addObject: optionSpite];
    optionSpite.position = CGPointMake(slot * positionIncrement, size.height*0.60);
    [optionSpite setAnchorPoint:CGPointMake(0.5f, 0.5f)];

    // Add the description
    CCLabelBMFont *optionDescription = [CCLabelBMFont labelWithString:description fntFile:@"bodyFont.fnt" width:stripWidth alignment:kCCTextAlignmentCenter];
    [self addChild:optionDescription];
    optionDescription.position = CGPointMake(slot * positionIncrement, size.height*0.30);
    [optionDescription setAnchorPoint:CGPointMake(0.5f, 0.5f)];

    // Add the title
    CCLabelBMFont *optionTitle = [CCLabelBMFont labelWithString:title fntFile:@"titleFont.fnt" width:stripWidth alignment:kCCTextAlignmentCenter];
    [self addChild:optionTitle];
    optionTitle.position = CGPointMake(slot * positionIncrement, size.height*0.90);
    [optionTitle setAnchorPoint:CGPointMake(0.5f, 0.5f)];

}
[self scheduleUpdate]; //Update only prints counter to see how many frames it lasts
}


-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
    return YES;
}

-(void) update:(ccTime)delta
{
    CCLOG(@"counter: %d",counter);
    counter++;
}

-(void) onExit
{
    [optionsArray release];
}


@end

`

  • 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-15T08:26:36+00:00Added an answer on June 15, 2026 at 8:26 am

    I figured it out, it wasn’t anything to do with the code I posted, so sorry about that. It was just a stupid release call to a non-retained array. Retained the array previously and it worked fine. Sorry about crying wolf

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

Sidebar

Related Questions

trying to work out how to install zipArchive extension with MAMP, but not having
Trying this again I have this samplet of code it is not complete but
Trying to build out an exception if move.UserId does not equal currentUserId then Redirect
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
I am trying to make a script that lists only folders within a folder.
Trying to find some information on this but am unable to get any results
Trying to execute a Powershell cmdlet from a MVC 3 Controller using impersonation but
Trying to connect to a SQL Server 2005 instance remotely but getting the following
Trying to find the links on a page. my regex is: /<a\s[^>]*href=(\\'??)([^\\' >]*?)[^>]*>(.*)<\/a>/ but
Trying to use Net::SFTP, version 2.05 (appears to be the latest). But it fails

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.