Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Array holdning every unit in a grid system

Author
Message
eyyYo
17
Years of Service
User Offline
Joined: 1st Aug 2007
Location:
Posted: 18th Aug 2007 00:28
Hi!

Im making a gridsystem on the "ground" in my game. Every unit should hold a different value (1,2 or 3. Grass, sand or water). Every unit should have the value 1 on start, though.

So its like:


And then the DeclareMap() function:


Now something is clearly wrong in the DeclareMap() function. Can someone tell me whats wrong?

Thanks in advance!
Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 18th Aug 2007 01:45
dim MapGrid(nrOfGrids)

should be

dim MapGrid(X, Y, 1)

Note also that arrays are zero-based, so using 0 as the last array dimension would work fine.

- Jane
eyyYo
17
Years of Service
User Offline
Joined: 1st Aug 2007
Location:
Posted: 18th Aug 2007 03:26 Edited at: 18th Aug 2007 15:46
okey, so i do this "dim MapGrid(X, Y, 1)" for every unit in the world, right? (with a for)

then if im on x=45 and z=34 i just call MapGrid(45,34) and will get the result "1"?

Edit: Never mind, got a hold of it

Login to post a reply

Server time is: 2024-09-27 02:25:31
Your offset time is: 2024-09-27 02:25:31