顺时针或逆时针创建球

时间:2017-03-13 07:31:14

标签: actionscript-3 flash rotation geometry angle

enter image description here

创建球

  1. 如果杆向A点(顺时针方向)移动,则沿B方向(逆时针方向)创建球。
  2. 如果杆向B点移动(逆时针方向),则在A方向(顺时针方向)上创建球。
  3. 这是我现有的代码

    var randomRotation:Number;          
    
    randomRotation = randomRange(_bar.rotation - randomRange(150,250),_bar.rotation + randomRange(150,250));
    ball.rotation = randomRotation;
    ball.x = stage.stageWidth * 0.5;
    ball.y = stage.stageHeight * 0.5;
    

    酒吧运动

    1. 走向最短的半径。
    2. 这是我现有的代码

      var angleDiff:Number = 180 - Math.abs(Math.abs(_bar.rotation - ball.rotation) - 180);
      var angleDiffPlus:Number = 180-Math.abs(Math.abs((_bar.rotation+speed)-ball.rotation)-180);
      var angleDiffMinus:Number = 180-Math.abs(Math.abs((_bar.rotation-speed)-ball.rotation)-180);
      
      if (angleDiffPlus < angleDiff)
      {
          dr = 1;
      }
      else if (angleDiffMinus < angleDiff)
      {
          dr = -1;
      }
      else
      {
          _bar.rotation = ball.rotation;
      }
      
      _bar.rotation +=  speed * dr;
      

      那么如何才能解决这些问题。

      提前致谢

0 个答案:

没有答案