hello all, i am trying to do somthing super simple but i just cant wrap my head around it.
i have a movieclip that is in the shape of a tree.
i need to get a random point on the tree. so i first get a random point on the stage, then i check if that point is over the tree (with hitTestPoint)
if it is then i return the point since i need the x and y coordinates to do something.
if not i need to get another point.
my problem is that i cant figure out how to get another one if my point is not valid. i did something like:
var point:Point = new Point ((Math.random () * _stageWidth), (Math.random () * _stageHeight));
if (_treeArea.hitTestPoint (point.x, point.y, true)) {
return point;
} else {
// how do i get another one and redo the previous steps? i miss basic's GOTO LINE :(
}
maybe something recursive should be done? how?