Advertisement
nutter666

Untitled

Jan 14th, 2016
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function rotateOrbitAngle(){
  2.            
  3.             currentAngle = MathX.normaliseAngle(currentAngle)
  4.             targetAngle = MathX.normaliseAngle(targetAngle)
  5.            
  6.             if(Math.abs(MathX.angleDifference(currentAngle,targetAngle)) > minMoveDistance){
  7.            
  8.             var ix = currentAngle * stage.mouseX
  9.             var iy = currentAngle * stage.mouseY
  10.             var ox = targetAngle * player.x;
  11.             var oy = targetAngle * player.y;
  12.            
  13.             if ( ix * oy > iy * oy ){
  14.                 this.rotateCW()
  15.             }
  16.             else{
  17.             this.rotateCCW();
  18.             }
  19.             }  
  20.         }
  21.        
  22.        
  23.         function rotateCW() {
  24.         // rotate normally
  25.         currentAngle += playerSpeed;
  26.         currentAngle = MathX.normaliseAngle(currentAngle)
  27.         }
  28.        
  29.         function rotateCCW() {
  30.         // rotate in reverse
  31.         currentAngle -= playerSpeed;
  32.         currentAngle = MathX.normaliseAngle(currentAngle)
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement