I have been looking all around this site and all the tutorials it has pointed me to. But, I have not found a really explanation of an Matrix, and how to use one. I know how to make one and they work well for map layouts. But I do not know how to use them as a map. Can some one point me in the right direction or show me some thing I have over looked.
Give http://tifreakware.net/tutorials/83p/b/tifw/les8.htm a look, see if that doesn't help give you a general idea on what you are looking to do. =]
Basically, they're a two-dimensional array of values; the normal system is to use each element in the array to represent a character or tile in a two-dimensional map.
Matrices are fun Very Happy Accessing elements is somewhat a PITA imo. Matrices work kind of like the Output() command. As in, (1,1) is the top left hand corner, and you work downwards and to the right. (3,1) is the third element down, and the 1st to the right. Also, read TiFreak's tutorial still Smile

Edit: Oh, and changing the dimensions of a matrix is a little awkward too. If you have matrix A , and it is 5 wide and 3 tall, dim([A]) would return {3,5} (note how it is in list form). To make matrix A 4 tall and 6 wide, {3,6}->Dim([A])
Indeed, there's no good way to expand the size on the fly, the way you can do dim(L1)+1->dim(L1
dim([A])+{0,1}->dim([A

Would that work, make it 1 size larger in the X direction
hmm, if you use two for loops, doesn't that make a map? (that all I can remember XD)
_player1537 wrote:
dim([A])+{0,1}->dim([A

Would that work, make it 1 size larger in the X direction
Hey, I think that actually would! Nice work, that didn't occur to me. Of course, you can omit the ending } character.

@Qazz: I suppose it does, but you also need to toss a sub() command in as well. Sonlen's the new up-and-coming expert on that. Smile

Code:
For(A,0,1
For(B,0,1
End
End


That doesn't create a map. Also depends on your definition of maps, Pokemon can't be made with a couple loops determining what is in it. Also depends on what type of map.

Edit: I thought I was the string expert >Very Happy Just Joking
_player1537 wrote:

Code:
For(A,0,1
For(B,0,1
End
End


That doesn't create a map. Also depends on your definition of maps, Pokemon can't be made with a couple loops determining what is in it. Also depends on what type of map.
Razz You know what he meant.


Code:
dim([A]->L1
For(A,1,L1(1
For(B,1,L1(2
Output(A,B,sub(" 8",[A](A,B
End
End
Razz Actually, I thought he meant the creating of the data from a matrix... woops.
_player1537 wrote:
Razz Actually, I thought he meant the creating of the data from a matrix... woops.
Oh, I assumed he meant rendering a map from a matrix, or interpreting a matrix as a map. Qazz, can you confirm what you meant?
I thought it was creating a matrix because that's what I used in that RPG program. It was for making a border around the map. Zerocode, do you understand matrices yet? If not, ask Smile
i find it faster, easier, and more size efficient to use strings for maps instead of matrices
KermMartian wrote:
_player1537 wrote:
dim([A])+{0,1}->dim([A

Would that work, make it 1 size larger in the X direction
Hey, I think that actually would! Nice work, that didn't occur to me. Of course, you can omit the ending } character.

@Qazz: I suppose it does, but you also need to toss a sub() command in as well. Sonlen's the new up-and-coming expert on that. Smile



lol, I remember that XD
Anakclusmos wrote:
i find it faster, easier, and more size efficient to use strings for maps instead of matrices
Indeed, as many people do. It's really up to whichever the programmer feels more comfortable with, plus in many cases one of the two is the better method.
Matrices usually are hassle-free when it comes to hit detection.
Both is a good idea imo Wink Allows speed of displaying, combined with ease of hit detection
Raylin wrote:
Matrices usually are hassle-free when it comes to hit detection.
Aye, that's one of their big advantages. It's easier to grab [A](5,5) than sub(Str1,5*16+5,1.
string0=map

" "=sub(string0,y16+x,1

hit detection in Ans
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement