home *** CD-ROM | disk | FTP | other *** search
- with(joystick)
- {
- if(!Key.isDown(32))
- {
- if(dragging)
- {
- var p = 0;
- while(p <= 10)
- {
- angle = Math.atan2(knob._ymouse - knob._y,knob._xmouse - knob._x);
- var bool = false;
- var newx = 0;
- var newy = 0;
- if(Math.abs(knob._x - _root._xmouse) > 10)
- {
- newx = knob._x + Math.cos(angle) * 5;
- var i = 1;
- while(i <= 4)
- {
- if(_root["GEARCHECK" add i].hittest(newx + _x,knob._y + _y))
- {
- knob._x = newx;
- }
- i++;
- }
- }
- if(Math.abs(knob._y - _root._ymouse) > 10)
- {
- newy = knob._y + Math.sin(angle) * 5;
- var i = 1;
- while(i <= 4)
- {
- if(_root["GEARCHECK" add i].hittest(knob._x + _x,newy + _y))
- {
- knob._y = newy;
- }
- i++;
- }
- }
- with(knob)
- {
- if(_root.GEARCHECK1.G3.hittest(_x + _parent._x + _parent._parent._x,_y + _parent._y + _parent._parent._y))
- {
- gear = 1;
- data1.g = 1;
- }
- else if(_root.GEARCHECK1.G4.hittest(_x + _parent._x + _parent._parent._x,_y + _parent._y + _parent._parent._y))
- {
- gear = 2;
- data1.g = 2;
- }
- else if(_root.GEARCHECK2.G3.hittest(_x + _parent._x + _parent._parent._x,_y + _parent._y + _parent._parent._y))
- {
- gear = 3;
- data1.g = 3;
- }
- else if(_root.GEARCHECK2.G4.hittest(_x + _parent._x + _parent._parent._x,_y + _parent._y + _parent._parent._y))
- {
- gear = 4;
- data1.g = 4;
- }
- else if(_root.GEARCHECK3.G3.hittest(_x + _parent._x + _parent._parent._x,_y + _parent._y + _parent._parent._y))
- {
- gear = 5;
- data1.g = 5;
- }
- else if(_root.GEARCHECK3.G4.hittest(_x + _parent._x + _parent._parent._x,_y + _parent._y + _parent._parent._y))
- {
- gear = 6;
- data1.g = 6;
- }
- }
- p++;
- }
- shaft._xscale = Math.sqrt((knob._x - shaft._x) * (knob._x - shaft._x) + (knob._y - shaft._y) * (knob._y - shaft._y));
- shaft._rotation = Math.atan2(knob._y - shaft._y,knob._x - shaft._x) * 180 / 3.141592653589793;
- }
- }
- else
- {
- var OBJECTO = _root["GEARCHECK" add Math.ceil(data1.g / 2)]["G" add (4 - data1.g % 2)];
- joystick.knob._x = OBJECTO._x + _root["GEARCHECK" add Math.ceil(data1.g / 2)]._x - joystick._x;
- joystick.knob._y = OBJECTO._y + _root["GEARCHECK" add Math.ceil(data1.g / 2)]._y - joystick._y;
- shaft._xscale = Math.sqrt((knob._x - shaft._x) * (knob._x - shaft._x) + (knob._y - shaft._y) * (knob._y - shaft._y));
- shaft._rotation = Math.atan2(knob._y - shaft._y,knob._x - shaft._x) * 180 / 3.141592653589793;
- }
- }
-