Problems with arrays
BlitzPlus Forums/BlitzPlus Beginners Area/Problems with arrays
| ||
Hello, I'm trying to make a 5 by 5 board for a puzzle game. I'm using arrays and defining it as such: |
| ||
Whoops, accidentally pressed the post button. ...it as such: Dim board(5,5) board(1,1) = 0 ;...and so on so, since the pieces in the game have four sides (left, right, up, down) I was wondering how I store such information in the board. I really don't want to have to do something like this: Dim boardLeft(5,5) .....so on Dim boardRight(5,5) .....so on i feel like there's an easier way to do this. Any suggestions are most appreciated. |
| ||
so, since the pieces in the game have four sides (left, right, up, down) I was wondering how I store such information in the board What information, like what is to each side of the piece? |
| ||
You could do something like this: Dim board (5,5,1) (x,y,z) x= x location y= y location z= side (just pick four values, e.g. 1,2,3,4 to indicate left,right,up,down, and store these in this slot. ) |
| ||
Response to Sauer... Each side of the pieces have different colors (blue, red, green, etc.) which I'm representing by a number (1=blue, etc.) |
| ||
Response to xlsior... I already tried using a third dimension, and it won't let me store one. I'm gonna try again, but I'm pretty sure when I tried it it didn't work. |
| ||
Never mind! I can store a third dimension in the array. Before, it must have been a syntax error on my part. Thanks for the help! Just one last side question: does Dim mean dimension, Declare In Memory, or both? |
| ||
I always read it as dimension, but declare in memory makes just as much sense. |