We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Here I have 1 array with two different iterations of the possible shapes it can create. How can I assign these shapes to variables that I would then cycle through using the random function?
For example, the first shape would be 1, then second shape would be 2 etc. random(1,2,3etc)
shape[0] = new Cell(4, 0, 35, true);
shape[1] = new Cell(5, 0, 35, true);
shape[0] = new Cell(5, 0, 35, true);
shape[2] = new Cell(5, 1, 35, true);
Answers
in line 4 : why not shape[2] and line 5 : shape[3] ?
you don't need to assign arrays to variables
if you like, each entry in the array (each line in the array) is a variable already
hence you can treat an entry like shape[2] like a normal variable
Random
now your question is:
just say
an index is the line number / entry number of an array (it's the number in the [] part
and currentShapeIndex after the line holds a random line number of the array. So use it:
or whatever