HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

2 Dimensional Array

06-05-2009, 01:15 PM#1
Grags
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