Computer Science Canada 2d array, how do I........ |
Author: | DanShadow [ Fri Jan 23, 2004 11:41 am ] | ||||
Post subject: | 2d array, how do I........ | ||||
Im trying to make a 2D array holding x and y positions in a map like so:
That makes 100 tiles, 10*10. Each tile is 25 pixels away from eachother. Im trying to make it like th is:
Of course this wont work because Pic.Draw requires the x and y co-ordinates seperately...but in my 2D array, map declares both x and y co-ordinates as one variable(array). Is there a way I can declare it so I could use the idea ive got (in the pic.draw command) in placing units? My teacher told me it could when I handed in my ISU..because I did it the other way, with arrays for "mapx,mapy,mapt" (mapt=map tile type). If you can offer any suggestions, or help, thanks! |
Author: | Cervantes [ Fri Jan 23, 2004 1:51 pm ] |
Post subject: | |
wouldn't Pic.Draw (airmer, map (i,0), map (0, k), picMerge) work? dunno haven't tried it Cheers |
Author: | DanShadow [ Fri Jan 23, 2004 2:09 pm ] |
Post subject: | |
no it wont, because the array is 1..10 if you put a '0' in there, it is out of the subscript range of the array |
Author: | Cervantes [ Fri Jan 23, 2004 2:18 pm ] |
Post subject: | |
then can you create a variable for the x and y that you get from the array? not sure how it would work though, |
Author: | Tony [ Fri Jan 23, 2004 3:27 pm ] |
Post subject: | |
well if you just need an array to hold pixel locations of tiles, I think you can do with a single 1D array to hold your multiples of 25... Pic.Draw(aimer, multiple(2),multiple(3),picMerge) which translates into 50,75 coordinats |
Author: | DanShadow [ Fri Jan 23, 2004 11:28 pm ] |
Post subject: | |
holy crap! Im an idiot, I cant believe i didnt figure that out!! Thanks Tony!!! |
Author: | Tony [ Sat Jan 24, 2004 12:23 am ] |
Post subject: | |
haha no problem 8) |
Author: | DanShadow [ Sat Jan 24, 2004 7:37 pm ] | ||
Post subject: | |||
aww crap... I forgot to tell you that the game is isometric...so it doesnt quite work.
This draws a regular 10*10, 2D tile grid like in checkers or chess. Thats wh y I need something that wo rks with ""map(x,y)""...because it doesnt draw isometric that wa y... |
Author: | Delos [ Sat Jan 24, 2004 8:51 pm ] | ||
Post subject: | |||
Just a thought...but how about making a type. eg.
Create your array of loc's and assign the values as necassary... |
Author: | DanShadow [ Sat Jan 24, 2004 9:00 pm ] |
Post subject: | |
yeah...but problem is, I dont know how to save records. [url]http://www.compsci.ca/v2/viewtopic.php?t=3260 [/url] At t hat link, I asked the question...now how would I go about saving record-arrays??? lol |
Author: | Delos [ Sat Jan 24, 2004 9:48 pm ] | ||
Post subject: | |||
Open the file, and there is your array! Did that help? Perhaps I misunderstood your intentions. BTW, I did this code in the post...so it may be a tad buggy...hehehe |