View Full Version: whats wrong with this code?!?

C++ Learning Community > Other Programing Languages > whats wrong with this code?!?


Title: whats wrong with this code?!?
Description: action script


shortys team - December 5, 2003 03:35 AM (GMT)
CODE

onClipEvent(load){
hyp = 0;
opp = 0;
adj = 0;
angle = 0;
which_area = 0;
}
onClipEvent(enterFrame){
if ((_xmouse < _x) && (_ymouse < _y)) {which_area = 0;}
if ((_xmouse < _x) && (_ymouse > _y)) {which_area = 90;}
if ((_xmouse > _x) && (_ymouse < _y)) {which_area = 270;}
if ((_xmouse > _x) && (_ymouse > _y)) {which_area = 180;}
hyp = Math.sqrt((_x-_xmouse * _x-_xmouse)+(_y-_ymouse * _y-_ymouse));
opp = Math.abs(_xmouse-_x);
adj = Math.sqrt((hyp * hyp)-(opp * opp));
angle = Math.asin(opp/adj);
_rotation =  angle + which_area;
}

its sussposed to point an object towards the mouse?? any ideas ?

Xception - December 5, 2003 07:39 PM (GMT)
And what does it do instead of what it is supposed to do?

shortys team - December 5, 2003 08:54 PM (GMT)
umm the angle doesnt give a value and the object swings back and forth




* Hosted for free by InvisionFree