New to scripting, trying to build a tutorial game to the android phone. Getting 2 errors,
BCE0019: ‘isMatched’ is not a member of ‘Object’.
and
BCE0048 Object does not support slicing
With the bce0019 error, theres a couple other items with the same exact error (isFaceUp, img).
I beleive all the issues are contained in this portion of the script:
class Card extends System.Object
{
var isFaceUp:boolean = false;
var isMatched:boolean = false;
var img:String;
var id:int;
function Card(img:String, id:int)
{
this.img = img;
this.id = id;
}
}
function BuildDeck()
{
var totalRobots:int = 4;
var card:Object;
var id:int = 0;
for(i=0; i<totalRobots; i++)
{
var aRobotParts:Array = ["Head", "Arm", "Leg"];
for(j=0; j<2; j++)
{
var someNum:int = Random.Range(0, aRobotParts.length);
var theMissingPart:String = aRobotParts[someNum];
aRobotParts.RemoveAt(someNum);
card = new Card("robot" + (i+1) + "Missing" + theMissingPart, id);
aCards.Add(card);
card = new Card("robot" + (i+1) + theMissingPart,id);
aCards.Add(card);
id++;
}
}
}
function FlipCardFaceUp(card:Card)
{
card.isFaceUp = true;
if(aCardsFlipped.IndexOf(card) < 0)
{
aCardsFlipped.Add(card);
if(aCardsFlipped.Count == 2)
{
playerCanClick = false;
yield WaitForSeconds(1);
if(aCardsFlipped[0].id == aCardsFlipped[1].id)
{
//MATCH!
aCardsFlipped[0].isMatched = true;
aCardsFlipped[1].isMatched = true;
matchesMade ++;
if(matchesMade >= matchesNeededToWin)
{
playerHasWon = true;
}
}
else
{
aCardsFlipped[0].isFaceUp = false;
aCardsFlipped[1].isFaceUp = false;
}
aCardsFlipped = new ArrayList();
playerCanClick = true;
}
}
}