Game Development Reference
In-Depth Information
}
else if (child.name == " startPointClip " )
{
_startPoint = new Point(child.x, child.y);
child.visible = false;
}
else if (child.name == " endPointClip " )
{
_endPoint = new Point(child.x, child.y);
child.visible = false;
}
else if (child is IWall)
{
_walls.push(child);
}
else if (child is Shape)
{
child.cacheAsBitmap = true;
}
}
}
When the level initializes in the constructor, it walks through its
entire display list, identifying each component and storing it in the
appropriate variable or Vector. This type of
allows the level
to be fairly loosely designed in the IDE, with no requirements for
layering order of any of the components.
scan
public function validate():Error
{
var err:Error;
if (!_startPoint)
{
err = new Error(ERROR_NO_START_POINT);
}
else if (!_endPoint)
{
err = new Error(ERROR_NO_END_POINT);
}
else if (!_walls.length)
{
err = new Error(ERROR_NO_WALLS);
}
return err;
}
As we saw in the engine class, the validate method returns one
of three different errors, depending on elements that are missing
Search Nedrilad ::




Custom Search