Hello, how are all of you guys doing?
Well here’s my problem:
I’m trying to “limit”or create a boundary for my mc that is being controlled by the influence of the mouse. here is the source:
/**********************************************************
Hero Fish
Movement AI.
**********************************************************/
onClipEvent (load) {
mousefollow = function () {
myRadians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
_root.yChange = Math.round(_root._ymouse-this._y);
_root.xChange = Math.round(_root._xmouse-this._x);
if(_root.moveAllow == false)
{
_root.xChange = 0
_root.yChange = 0
}
_root.yMove = Math.round(_root.yChange/_root.speed);
_root.xMove = Math.round(_root.xChange/_root.speed);
this._y += _root.yMove;
this._x += _root.xMove;
this._rotation = myDegrees+90;
};
}
onClipEvent (enterFrame) {
mousefollow();
}
(Slightly modified from Actionscript.org tutorials.)
When I test my .swf it works ok because when the mouse is out of the .swf box the mc can no longer pass the boundary, but when I make my application full screen the mc follows my mouse past the given boundary.
see below pictures.
So I wanted to limit the mc, but at the same time allow it to follow my mouse, while the mouse is outside the box.
Good MC, stay inside that little box sucker!!!
Bad mc… stay in that boundary!!!
So I’m open to any suggestion…
Here’s some of my hypothesis… So I don’t act like a actionscript freeloader…
I could use an if statement?
I could create a square, boundary mc labeled boundary, and if hit test is true, move it back? , but having the chance of being stuck…
I’m clueless…