Multidimensional Arrays

You must understand the Game Editor concepts, before post here.

Multidimensional Arrays

Postby irblinx » Mon Sep 11, 2006 12:18 pm

I want to create a two dimensional array and from what I can see there is no way of doing this from the variable editor, therefore I assume that I can just go ahead and use the global code section to declare it:

int levelData[2][4] = { {0, 1, 2, 4}, {3, 4, 5, 6} };

If this works in GE (?), how do I then assign this variable to a group so that it is included in the group save file?
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby makslane » Mon Sep 11, 2006 1:12 pm

To save data not supported in the Variables panel, you need to use your own save function, by using the fopen, fwrite and other C functions.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby irblinx » Mon Sep 11, 2006 5:02 pm

ok thanks, can I add a request for 2 dimensional arrays on the interface then ;)
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby makslane » Mon Sep 11, 2006 6:43 pm

In my task list
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby irblinx » Mon Sep 11, 2006 10:11 pm

sweet :)
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby Game A Gogo » Mon Sep 11, 2006 11:34 pm

irblinx wrote:sweet :)

i dont know why, but it sounde like sweat :)
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby irblinx » Wed Sep 13, 2006 11:53 pm

Further to this, how do I actually get the variable declarations in global code to execute?

I can't put them in a function and call them as the need to be declared for other functions to work and therefore as far as I can tell this section of code never gets actioned.
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby makslane » Thu Sep 14, 2006 12:02 am

Can you show me the code?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby irblinx » Fri Sep 15, 2006 6:28 am

Everything seems to be in place now and I've sorted a couple of typos and some scope problems created by me moving things around to try and fix the problem!!

Now the only problem left is that for some reason I seem to be getting very strange results reading the contents of the array back out, it is as if the column and row references are the wrong way around and that it is reading the column ref right to left rather than left to right. I can't help but feel I'm making some obvious mistake that I haven't spotted!
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby makslane » Fri Sep 15, 2006 12:06 pm

Can you post a little example?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby irblinx » Fri Sep 15, 2006 1:52 pm

I'm just about to have another play and see if I can spot anything obvious, if I have no joy I'll email you an example
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby irblinx » Thu Sep 21, 2006 7:19 am

And now fixed and working great, thanks to Makslane. :D
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby EasyViber » Sat Dec 02, 2006 11:07 am

and now I still don't know how to make multidimensional array :)

ah... ok... I think i can solve my problem without md array :)
EasyViber
 
Posts: 21
Joined: Fri Feb 24, 2006 4:43 pm
Location: Zagreb, Croatia
Score: 0 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron