HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to do a (15,15) 2D Array in GUI?

06-05-2009, 02:06 PM#1
Grags
I posted this about an hour ago, but for some reason it never appeared on the boards?

Anyway... Ive read up everywhere all over these forums and other forums how to go about doing this. But all the explanations make no sense to me :(.

I've been playing with a calculater for the past 20 mins trying to figure out how this is working, but I just can't get it. I'm used to Visual Studio.Net where I just just declare a 2d variable to start with Example: Dim RegionXY(15,15) As Region I've even drew a 4x4 grid in paint and tried all the possible math solutions I can come up with, to grab the X and Y coords on a tiny scale.

The game i'm trying to make I have written many times before on the Commodore 64 \o/, QBasic, YABasic(ps2), and Visual Studio.Net 2003. I figured it was time to bring it to World Editor and see what you guys think of it. But I need a 2D Array

The game runs on a 15, 15 grid, and each and every region will hold an integer value that will say whether the area is pavable(>0), has a blahblah(1) has a blahblahblah(2) etc etc so I guess what im looking for is something like this...


Code:
User Presses up
    If Region(PlayerX, PlayerY - 1) > 0 Then Blah

For Y = 1 to 15
    For X = 1 to 15
        If Region(X, Y) = 2 Then Blah
    Next
Next
^Obviously just examples.

Can someone please explain this is in dummy language. Patronise me! I just need to understand this.


Edited. Omg, i'm so sorry. I'm new to these boards. and couldn't find my original post. can a moderater please close this thread. Again please accept my apologies.
06-05-2009, 02:27 PM#2
Dragoon
Can you please explain to me, what you want exactly, cuz I don't understand ya
06-05-2009, 02:36 PM#3
Grags
An easy to understand explanation of how GUI 2D arrays work.
06-05-2009, 02:48 PM#4
Here-b-Trollz
Collapse Simulated 2D Array:
2DArray[x,y]
//equals:
1DArray[x*15+y]
06-05-2009, 03:29 PM#5
0zyx0
There is no 2D arrays in GUI. You can however simulate them, but that would be easier to do in vJASS. Since you are new, I should probably post this link.
06-05-2009, 03:55 PM#6
Zaraf
http://www.thehelper.net/forums/show...73&postcount=8
06-05-2009, 04:02 PM#7
Grags
Quote:
Originally Posted by Here-b-Trollz
Collapse Simulated 2D Array:
2DArray[x,y]
//equals:
1DArray[x*15+y]

Hey thanks for the reply, that actually makes some sense to me :) can u explain what the 15 is used for? i'm guessing it's either the X or Y.

So say region(14,15) would be region(14*15+15)?



OMG Zaraf! Finally a well written well described tutorial TYSM!
06-05-2009, 04:06 PM#8
Zaraf
no problem :)
06-05-2009, 04:13 PM#9
Grags
Yes I didnt see your post until I replied to a previous post. Thanks a lot and +repped