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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:11:30+00:00 2026-06-03T03:11:30+00:00

I am in the process of making a level editor for my game. I

  • 0

I am in the process of making a level editor for my game. I have used cocos2d to make the game. I have a level node that is a subclass of CCNode and contains all the level objects in the game. The level then gets added to a CCLayer. I want to save all the children of the level (an NSMutableArray) to a file in the resources folder. I want to load this NSMutableArray, loop through it, and add all the saved level objects to the level. I can’t save these level objects on the local device because the levels in the final game will be based off of this file and other devices need to have it ready along with all the other game resources. Is there any way to do this or do I have to just save strings containing all the properties of the level objects and search through those strings for the information necessary to load the level? If so, is there a way of reading and writing a c structure to a file in combination with an NSString? Here is what I have so far:

        NSString * filePath = @"LevelSaves.txt";
        NSString * fileRoot = [[NSBundle mainBundle]pathForResource:filePath      ofType:@"txt"];
        NSString * fileContents = [NSString stringWithContentsOfFile:fileRoot encoding:NSUTF8StringEncoding error:nil];
        NSArray * allLinedStrings = [fileContents componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
        ObjectFactory * objFactory = ObjectFactory::sharedObjectFactory();
        for (NSString * curString in allLinedStrings) {
            NSArray * seperatedString = [curString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@";"]];
            NSString * objectID = (NSString*)[seperatedString objectAtIndex:0];
            NSArray * properties = (NSArray*)[seperatedString objectAtIndex:1]; //not really sure about this part. Haven't tried saving anything there yet.
            objFactory->createObject(objectID,properties);
  • 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-03T03:11:31+00:00Added an answer on June 3, 2026 at 3:11 am

    You cannot save data in the application bundle (which I believe is what you meant by “resources” folder). You can save them in the app’s NSDocumentDirectory, and if your objects conform to NSCoding, you can serialize them using NSKeyedArchiver.

    Do the above for debug, and when you’re done editing the level, bundle it for release and use NSKeyedUnarchiver to deserialize.

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

Sidebar

Related Questions

I'm in the process of developing an android game. I have an activity that
I am in the process of making a website that involves a shopping cart.
In a game that I am making, the moment the game scene initializes, a
In the process of making an ebook, users have to edit its content, edit
I'm in the process of making some changes to a library that I'm using.
I am making a web app that will process large files (1gb+). While the
What is the process behind making custom widgets (using Qt) that don't look...well...ugly? I
I'm making a game in Java. I load the level map processing a text
I am in process of making a game where the health bar (animated) and
I have a process that feeds a piece of hardware (data transmission device) with

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.