Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function rotateOrbitAngle(){
- currentAngle = MathX.normaliseAngle(currentAngle)
- targetAngle = MathX.normaliseAngle(targetAngle)
- if(Math.abs(MathX.angleDifference(currentAngle,targetAngle)) > minMoveDistance){
- var ix = currentAngle * stage.mouseX
- var iy = currentAngle * stage.mouseY
- var ox = targetAngle * player.x;
- var oy = targetAngle * player.y;
- if ( ix * oy > iy * oy ){
- this.rotateCW()
- }
- else{
- this.rotateCCW();
- }
- }
- }
- function rotateCW() {
- // rotate normally
- currentAngle += playerSpeed;
- currentAngle = MathX.normaliseAngle(currentAngle)
- }
- function rotateCCW() {
- // rotate in reverse
- currentAngle -= playerSpeed;
- currentAngle = MathX.normaliseAngle(currentAngle)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement