No need to use an array just use two for loops. In fact the array wouldn't help in the case of the triangle.
For a 3x3 square whose top left is at x,y do this:
Global number x=100
Global number y=30
Start of layout
For "row" from 0 to 2
For "col" from 0 to 2
--- create sprite at 32*loopindex("col")+x, 32*loopindex("row")+y
And for a triangle do this:
Start of layout
For "row" from 0 to 2
For "col" from 0 to loopindex("row")
--- create sprite at 32*loopindex("col")+x, 32*loopindex("row")+y