Advertisement
progrmor

Untitled

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