Advertisement
Guest User

Camera.java

a guest
Jul 5th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public class Camera {
  2. private static Player target;
  3. private static float x, y;
  4.  
  5.  
  6. public Camera(Player target, float x, float y){
  7. Camera.target = target;
  8. Camera.x = x;
  9. Camera.y = y;
  10. }
  11. public void update(){
  12. Camera.setX(target.getX());
  13. Camera.setY(target.getY());
  14. GLU.gluLookAt(Camera.getX(), Camera.getY(), 0, target.getX(), target.getY(), 0.0f, 0f, 1f, 0f);
  15. }
  16.  
  17.  
  18. public static Player getTarget() {
  19. return target;
  20. }
  21.  
  22.  
  23. public static void setTarget(Player target) {
  24. Camera.target = target;
  25. }
  26.  
  27.  
  28. public static float getX() {
  29. return x;
  30. }
  31.  
  32.  
  33. public static void setX(float f) {
  34. Camera.x = f;
  35. }
  36.  
  37.  
  38. public static float getY() {
  39. return y;
  40. }
  41.  
  42.  
  43. public static void setY(float f) {
  44. Camera.y = f;
  45. }
  46.  
  47.  
  48.  
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement