arrays in cocos2d-x v3 C++

  • abhishek
    Likes 0

    Problem Description

    hii..
    i have created an array like this in xcode objective-C:

    //spellings for child lock screen
    //--------------------------------------------------
    array_digits = [[NSMutableArray alloc] initWithCapacity:9];
    [array_digits addObject:@"one"];
    [array_digits addObject:@"two"];
    [array_digits addObject:@"three"];
    [array_digits addObject:@"four"];
    [array_digits addObject:@"five"];
    [array_digits addObject:@"six"];
    [array_digits addObject:@"seven"];
    [array_digits addObject:@"eight"];
    [array_digits addObject:@"nine"];
    //--------------------------------------------------


    and then i access it to fill my textLabel like this:
    lbl_display.text = [NSString stringWithFormat:@"%@, %@, %@", [array_digits objectAtIndex:no1-1], [array_digits objectAtIndex:no2-1], [array_digits objectAtIndex:no3-1]];

    so how can i do this in cocos2d-x v3.0 C++
    basically what i want to do is implement a parent lock
    the screen will have numbers 1 to 9 and i want to present a qn like this to parents:

    Please enter these numbers to continue:
    One, Two, Three


    so i want to store the spellings in an array so that i can easily display the words
      

  • Sonar Systems admin
    Likes 0

    Do you know C++?

  • abhishek
    Likes 0

      hi..
    i am sorry if the question seems to be of noob level..
    the thing is, i know the basics of C++ and have mostly worked with objective-C only..
    so i dont know most of the C++ code syntax to be used in cocos2dx, plus things keep changing every now and then so previous methods might not work

    thats why asked you this question..
    a student should not feel ashamed to ask a question to his teacher..
    so i asked..
    laugh


    This reply has been verified.
  • Sonar Systems admin
    Likes 0

    Nothing wrong with asking, we recommend you learn C++ first so its upto the same level as Objective-c. This root will save you best in the long term and save you time.

Login to reply