2-dimensional arrays
Author |
Message |
Thuged_Out_G
|
Posted: Sat Jan 24, 2004 12:11 am Post subject: 2-dimensional arrays |
|
|
2D ARRAYs
Quote:
var x_y:1..2,1..3
if you think of them as table, it makes sense ....1..2 if the number of collums, and 1..3 is the number of rows
Quote:
------------
|1,1 | 2,1|
------------
|1,2 | 2,2|
------------
|1,3 | 2,3|
------------
this could be useful for storing x and y coords of something.
code: |
var x,y,button:int
loop
for i:1..3
Mouse.Where(x,y,button)
if button=1 then
x_y(1,i):=x
x_y(2,i):=y
end if
end for
end loop
for i:1..3
put "Xcoords: ",x_y(1,i)
put "Ycoords: ",x_y(2,i)
end for
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
thoughtful
|
Posted: Sat Jan 24, 2004 12:19 am Post subject: (No subject) |
|
|
nice simple tutorial, yea just to point out, i have used 2D arrays with whatdotcolor (for saving pictures as text files basically getting the color of each dot) , i have also used it with database records. It can be very use ful. |
|
|
|
|
|
JayLo
|
Posted: Sat Jan 24, 2004 9:43 am Post subject: (No subject) |
|
|
there's an alignment problem on this page. |
|
|
|
|
|
Andy
|
Posted: Sat Jan 24, 2004 12:25 pm Post subject: (No subject) |
|
|
ummm i already had a tutorial on arrays that included multi dimensions |
|
|
|
|
|
Tony
|
Posted: Sat Jan 24, 2004 2:23 pm Post subject: (No subject) |
|
|
i fixed the alighnment problem... it often occurs when multiple code tags are used. quote seems to not have such a probelem.
and yes... both dodge and I covered multidimentional arrays in our tutorials |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|