How to pass multi-dimensional arrays to a function
Posted: Tue Jul 11, 2017 1:10 pm
Hi, I've recently discovered that passing arrays to a function is possible. Well, I've decided to create a tetris clone, and, for the sake of optimization, I've put the sprites on a multi-dimensional array, storing them as strings. For example
And so on...
Then I would make a function to draw a random sprite on the screen based on an array "a", but, how do I declare an array in the parameters? and, how do I pass it?
Code: Select all
dim shared array(4, 5) as string
array(1, 1) = " # "
array(1, 2) = "###"
array(2, 1) = "# "
array(2, 2) = "# "
array(2, 3) = "# "
Then I would make a function to draw a random sprite on the screen based on an array "a", but, how do I declare an array in the parameters? and, how do I pass it?