Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Ball {
- private Vector2 velocity;
- private Vector2 position;
- private Vector2 acceleration;
- private int width;
- private int height;
- public Ball(float x, float y, int width, int height)
- {
- this.width = 10;
- this.height = 10;
- position = new Vector2(x,y);
- velocity = new Vector2(0,0);
- acceleration = new Vector2(400, 0);
- }
- public void update(float delta)
- {
- velocity.add(acceleration.cpy().scl(delta));
- /*
- if (velocity.y > 200)
- { velocity.y = 200 }
- */
- velocity.add(velocity.cpy().scl(delta));
- }
- public void onClick(InputHandler onClick) {
- int x = (int)onClick.getX();
- int y = (int)onClick.getY();
- switch (onClick.getAction()) {
- case InputHandler.ACTION_DOWN:
- case InputHandler.ACTION_MOVE:
- case InputHandler.ACTION_UP:
- }
- return false;
- }
- public float getX() {
- return position.x;
- }
- public float getY() {
- return position.y;
- }
- public float getWidth() {
- return width;
- }
- public float getHeight() {
- return height;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement