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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:43:28+00:00 2026-05-30T18:43:28+00:00

I’ve been wondering what the best way to store data would be in my

  • 0

I’ve been wondering what the best way to store data would be in my Cocos2d game.

When my game initiates, it selects a random type of enemy. Depending on the level, the amount of enemies changes. What I want to do is have a file that has all the amounts of enemy to spawn on it. I’d like to have this in a separate file if possible, so that it is easy to tweak and change.

EXAMPLE

Say for Level 3, Enemy_1 is chosen. It then goes to the Enemy_1 data file, and then finds the amount of sprites to create.

When searching for a way to do this, i’ve notcied that there are a couple of files built in to xCdoe that I could use. These include: Strings File, Property List and Rich Text File. My best guess is that I’d have to use a property list, but I am not sure how they work, and how it could be implemented into my game. Preferably could you give me the code for how to do this too?

Thanks in advance

EDIT:
I forgot to say that I can’t just have one properties file, but I need to have one for each type of enemy. This is because some enemies are harder to kill than others.

  • 1 1 Answer
  • 1 View
  • 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-30T18:43:29+00:00Added an answer on May 30, 2026 at 6:43 pm

    You probably can use one property list file.

    First, make sure you understand what a property list is. A property list is defined recursively as one of these things:

    • a string
    • a Boolean value
    • an integer
    • a floating-point number
    • a date (and time)
    • a blob of binary data
    • an array of property lists
    • a dictionary with strings for keys and property lists for values

    A property list can have arrays and dictionaries nested to any level. That’s why you can probably just use one property list. You can have your top-level object be a dictionary with two keys: “Enemies” and “Levels”. The value for the “Enemies” key is a dictionary with one entry for each type of enemy. The value for the “Levels” key is an array with one entry per level. Here’s an example:

    game property list

    You can use Xcode’s property list editor to create and modify the property list (like I did for that example). You can load it using +[NSDictionary dictionaryWithContentsOfFile:], or using NSPropertyListSerialization if you need more error checking. The Xcode plist editor isn’t that great, but even if you end up needing to write your own level editor, a property list is still a convenient way to store your game data.

    Property List Programming Guide

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have been unable to fix a problem with Java Unicode and encoding. The
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want to construct a data frame in an Rcpp function, but when I
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

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.