Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. double rotation = angle - lastAngle;
  2. selectedMob.rotate((float) (rotation));
  3.  
  4. public void rotate(float angle) {
  5. this.angle += angle;
  6. }
  7.  
  8. double rads = Math.atan2(dy, dx);
  9. double angle = Math.toDegrees(rads);
  10.  
  11. 09-13 00:03:53.708: V/GameActivity(23389): updating frame
  12. 09-13 00:03:53.708: V/GameActivity(23389): checked for all mobs
  13. 09-13 00:03:53.825: V/GameActivity(23389): Angle of finger is 360.0
  14. 09-13 00:03:53.825: V/GameActivity(23389): Angle of mob is 344.94818
  15. 09-13 00:03:53.825: V/GameActivity(23389): Last angle is 359.56921278299137
  16. 09-13 00:03:53.825: V/GameActivity(23389): Rotation will be 0.43078721700862843
  17. 09-13 00:03:53.825: V/GameActivity(23389): ****************
  18. 09-13 00:03:53.825: V/GameActivity(23389): updating frame
  19. 09-13 00:03:53.825: V/GameActivity(23389): checked for all mobs
  20. 09-13 00:03:54.137: V/GameActivity(23389): Angle of finger is 0.4275725068334077
  21. 09-13 00:03:54.137: V/GameActivity(23389): Angle of mob is 345.37897
  22. 09-13 00:03:54.137: V/GameActivity(23389): Last angle is 360.0
  23. 09-13 00:03:54.137: V/GameActivity(23389): Rotation will be -359.5724274931666
  24. 09-13 00:03:54.137: V/GameActivity(23389): ****************
  25.  
  26. while(Math.Abs(angle - lastAngle) > 180)
  27. angle += (angle > lastAngle ? -360 : 360);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement