Hi. I'm working on something for a class that is a script for a virtual card game. I'm trying to make a multi-dimensional array that will pass a value to the two cards being drawn and remove them from the arrays so that they aren't drawn as duplicates. When I run the script it gives me an out of range exception that conflicts with the script my teacher wrote as the main engine. Here is my code:
class CardArraySetup
{
private static var instance : CardArraySetup = new CardArraySetup();
public static function GetInstance() : CardArraySetup
{
return instance;
}
private var totalCardCount = new Array();
private var multiDimensionGrid = new Array();
private var flippedCards = new ArrayList();
function GetCardArray() : Array
{
return totalCardCount;
}
function GetGridArray() : Array
{
return multiDimensionGrid;
}
function GetCardsFlippedArray() : ArrayList
{
return flippedCards;
}
function ResetCardsFlipped()
{
flippedCards = new ArrayList();
}
function GridSetup()
{
for (i = 0; i < rows; i++)
{
multiDimensionGrid *= new Array();*
*for (j = 0; j < column; j++)*
*{*
*var someNum : int = Random.Range(0, totalCardCount.length);*
_multiDimensionGrid*[j]=totalCardCount;*_
_*totalCardCount.RemoveAt(i);*_
_*totalCardCount.RemoveAt(j);*_
_*}*_
_*}*_
_*}*_
_*}*_
_*```*_