User Tag List

Results 1 to 7 of 7

Thread: Multi-Dimensional arrays?

  1. #1
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,962
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.61%

    Multi-Dimensional arrays?

    Can we do these? How do we access them?

    For instance, something like:

    Code:
    int save_link_position[2][64];
    
    if(Link->InputUp/down/left/right)
    { 
       save_link_position[1][i]=Link->X;save_link_position[2][i]=Link->Y;i++;
    }

    And to read from arrays would you just reverse them?
    Code:
    if(i>15){
     this->X = save_link_position[1][i-16];
    }
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  2. #2
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,962
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.61%

    Re: Multi-Dimensional arrays?

    Just wondering if there is supposed to be two-dimensional arrays at this point, since there are a couple of bugs with them.

    What I need to do is completely rewrite all of my custom enemies by type (to avoid foreseeable and unavoidable stack overflow) of level, movement, and difficulty setting.

    The easiest thing to do would likely be:

    enemy_type[ffc_num_enemy][enemy_specific_ffc_variables];

    ffc script controller{ //stuff
    {
    for(i=1;i<init_num_variables;i++)
    {
    enemy_type[this_ffc_num][i] = (initialize_var[i]//local;
    }
    while(// etc..


    void enemy1(int ffc, int level){
    // do stuff
    // then decrement the array accordingly



    ...is what i'm thinking. Or I could create lots separate arrays that do something similar....dear god...which is fine too. I think that Allegro itself has a limit to two dimensional arrays so not sure if we can use any or not.

    If not, would anyone have any suggestions as to easily managing this.?

    An array of arrays. :crazy:


    EDIT: OK, I found an equally efficient alternative. Should be less of a burden on processer speed also..which brings me to my next question:

    How do all those clowns fit into that tiny car?!
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  3. #3
    I shall exalt myself over all Armagedddon Games bigjoe's Avatar
    Join Date
    Apr 2000
    Age
    39
    Posts
    5,622
    Mentioned
    87 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,577
    Level
    24
    vBActivity - Bars
    Lv. Percent
    94.16%

    Re: Multi-Dimensional arrays?

    When does stack overflow start to occur? I fear I might someday encounter it, as my scripts may get intensive.


  4. #4
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,962
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.61%

    Re: Multi-Dimensional arrays?

    I dunno? Maybe around 70 kb of raw uncommented code...give or take.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  5. #5
    Developer
    ZC Developer
    jman2050's Avatar
    Join Date
    Jun 2001
    Location
    Do you really need to know
    Age
    37
    Posts
    3,883
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    5,713
    Level
    23
    vBActivity - Bars
    Lv. Percent
    46.85%

    Re: Multi-Dimensional arrays?

    The language grammar and implementation was designed with the possibility of multidimensional arrays IIRC. No one had attempted them up to this point, so I'd like for you to outline any issues you have at this point
    AGN's Resident Zelda Classic Developer and Sonic the Hedgehog Fanboy

  6. #6
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,962
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.61%

    Re: Multi-Dimensional arrays?

    Ah, Well the only issue I'm getting with them currently, is that, well... they don't compile. XD
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  7. #7
    Keese ScaryBinary's Avatar
    Join Date
    Dec 2006
    Age
    49
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    919
    Level
    10
    vBActivity - Bars
    Lv. Percent
    53.72%

    Re: Multi-Dimensional arrays?

    Quote Originally Posted by Gleeok View Post
    Ah, Well the only issue I'm getting with them currently, is that, well... they don't compile. XD
    I'll second that. I was declaring them as Gleeok did, something like:
    Code:
    int myArray[5][10];
    I tried a few other non-standard declarations, but nothing seemed to work. This was with build...777, I believe.

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social