I am making a Tetris game and found it to be more difficult than you might think.
Perturbatio's code shoud fix the error. You haven't specified what it is but I guess it is array index out of bounds. If you make an array of size 4, then the indexes are [0] [1] [2] and [3]. [4] is not a valid index. Yet in your for loop i/i2 goes 0, 1, 2, 3 and 4. Either put VCell-1 or use for local i:int = 0 until VCell, which goes up to but not including VCell and the same changes for HCell. (Personally I'd use x and y rather than i and i2 but it makes no difference).
Though it can be done with arrays, it is actually easier for each "block" or "shape" to have a list of 4 points/coordinates rather than a 4x4 array. If you make a TPoint type with int fields x and y, and give each shape an array of 4 TPoints. The T shape for instance would be (-1, 0) (0, 0) (1, 0) (0, 1), with (0, 0) being the centre square. Implemented as points[i].x = -1; points[i].y = 0; etc
The list of points methods makes rotating easier and you might want to investigate it. But it is possible using arrays.
Last night I was playing a simple game on my phone similar to tetris which you might find easier to implement. It will give you the chance to sort out program design and finishing a game but avoid some of the more complex problems with a tetris game. (Sorry if I am insulting your intelligence, but I am currently making a tetris game and finding it difficult and I would consider myself an Intermediate, or at least above beginner, programmer).
The game is called QuadraPop and you can see a screenshot here
If you are interested I can describe the game for you.
Perturbatio's code shoud fix the error. You haven't specified what it is but I guess it is array index out of bounds. If you make an array of size 4, then the indexes are [0] [1] [2] and [3]. [4] is not a valid index. Yet in your for loop i/i2 goes 0, 1, 2, 3 and 4. Either put VCell-1 or use for local i:int = 0 until VCell, which goes up to but not including VCell and the same changes for HCell. (Personally I'd use x and y rather than i and i2 but it makes no difference).
Though it can be done with arrays, it is actually easier for each "block" or "shape" to have a list of 4 points/coordinates rather than a 4x4 array. If you make a TPoint type with int fields x and y, and give each shape an array of 4 TPoints. The T shape for instance would be (-1, 0) (0, 0) (1, 0) (0, 1), with (0, 0) being the centre square. Implemented as points[i].x = -1; points[i].y = 0; etc
The list of points methods makes rotating easier and you might want to investigate it. But it is possible using arrays.
Last night I was playing a simple game on my phone similar to tetris which you might find easier to implement. It will give you the chance to sort out program design and finishing a game but avoid some of the more complex problems with a tetris game. (Sorry if I am insulting your intelligence, but I am currently making a tetris game and finding it difficult and I would consider myself an Intermediate, or at least above beginner, programmer).
The game is called QuadraPop and you can see a screenshot here

If you are interested I can describe the game for you.