Advertisement
progrmor

Untitled

May 11th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. public class Ball {
  2.  
  3. private Vector2 velocity;
  4. private Vector2 position;
  5. private Vector2 acceleration;
  6.  
  7. private int width;
  8. private int height;
  9.  
  10.  
  11.  
  12. public Ball(float x, float y, int width, int height)
  13. {
  14. this.width = 10;
  15. this.height = 10;
  16. position = new Vector2(x,y);
  17. velocity = new Vector2(0,0);
  18. acceleration = new Vector2(400, 0);
  19.  
  20. }
  21.  
  22. public void update(float delta)
  23. {
  24. velocity.add(acceleration.cpy().scl(delta));
  25.  
  26. /*
  27. if (velocity.y > 200)
  28. { velocity.y = 200 }
  29. */
  30. velocity.add(velocity.cpy().scl(delta));
  31.  
  32. }
  33.  
  34. public void onClick(InputHandler onClick) {
  35. int x = (int)onClick.getX();
  36. int y = (int)onClick.getY();
  37. switch (onClick.getAction()) {
  38. case InputHandler.ACTION_DOWN:
  39. case InputHandler.ACTION_MOVE:
  40. case InputHandler.ACTION_UP:
  41. }
  42. return false;
  43. }
  44.  
  45.  
  46.  
  47. public float getX() {
  48. return position.x;
  49. }
  50.  
  51. public float getY() {
  52. return position.y;
  53. }
  54.  
  55. public float getWidth() {
  56. return width;
  57. }
  58.  
  59. public float getHeight() {
  60. return height;
  61. }
  62.  
  63.  
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement