A tool to operate the Array of two dimension
It may be easy to handle the Array of one dimension because of the API that we know. But I may be hard to operate the Array of two dimension. So I thought about this when I wanted to make a game of snake. If I can change the data of the snake, It will be easy to make the game of snake.
That is just a example, now let's see how to use it.
npm install matrix-lronelove --save
now you create a Array of two dimension with many functions in it.
for example, you can use matrix.set(1, 1, 'love'), It means you set col 1, row 1, with the value ,'love'.
But, be careful. To make it easy to use, the index starts at 1 not 0.
- matrix.set(row, col, value) : set the data of matrix with value at (row, col)
- matrix.changeRow(row1, row2): change two rows
- matrix.addCol() : add one col
- matrix.blockAnimate(row1, col1, row2, col2, right, top): It can make one block of the matrix to move. It is a very useful function.
- and so on.There are so many useful functions to use. But I am lazy. When I am free, I will complete the doc.