Type TGameBoard Global x,y,z,width,height,trans Global layer Global data:Int[][] ' <-----THIS IS THE ARRAY I WOULD LIKE To SPECIFY THE SIZE OF FROM CALLING A Function Global cellWidth = 10 Global cellHeight = 10 Function Create:TGameBoard(Width,Height) Local tempGameBoard:TGameBoard = New TGameBoard layer:+1 'width = getWidth 'height = getHeight tempGameBoard.width = Width tempGameBoard.Height = Height tempGameBoard.data = tempGameBoard.data[..Width] For Local i:Int = 0 Until Len(tempGameBoard.data) tempGameBoard.data[i] = tempGameBoard.data[i][..Height] Next 'use slice to resize array Return tempGameBoard End Function Method drawBoard() 'For Local repx=EachIn data For repx = 0 To (width-1) For repy = 0 To (height-1) xpixel = repx*cellWidth ypixel = repy*cellHeight data[repx][repy] = 1 If data[repx][repy] = 1 Then DrawOval(x+xpixel, y+ypixel, cellWidth, cellHeight) Next Next End Method End Type Local t:TGameBoard = TGameBoard.Create(10,20) Graphics 640,480,0,0 While Not KeyDown(KEY_ESCAPE) Cls t.drawBoard() Flip Wend End
You can't resize a multi-dimensional array with slices, but you can use an array of arrays for this. (a 1D array of 1D arrays).