[CODE]
private void CreateMaze(int h, int w)
{
int r = h * w;
Room[] rooms = new Room[r];
Random rm = new Random();
int newrm = rm.Next(0, r);
int nrmcntr = newrm;
do
{
rooms[newrm].rWall = "|";
if (newrm == rooms.Length() -1)
{
newrm = 0;
}
newrm += 1;
}
while (newrm != nrmcntr);
[/CODE]
At the line:
if (newrm == rooms.Length() -1)
I am trying to compare an integer to the last index of an array of room objects.
I get the error:
Method name expected
at that line but have no clue.
Thank you in advance for any explanations.
Loading
foo fooliosPosted Aug 6, 2007, 12:54 PM
mark adoraPosted Aug 6, 2007, 3:26 AM
if (newrm == rooms.Length() -1)
To:
if (newrm == rooms.Length -1)
Array length's a property not a method :)
Jan MontanoPosted Aug 6, 2007, 3:18 AM
Try replacing rooms.Length() with rooms.Length instead. Length is called as a Property, and not as a Method.
Cheers,
Jan