Want more features on Pastebin? Sign Up, it's FREE!
Guest

Ball.java

By: bassex96 on Apr 18th, 2013  |  syntax: Java  |  size: 1.05 KB  |  views: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package com.psillicoder.brickbreaker;
  2. //import com.psillicoder.brickbreaker.Paddle;
  3.  
  4. import com.badlogic.gdx.Gdx;
  5. import com.badlogic.gdx.graphics.Texture;
  6. import com.badlogic.gdx.math.Rectangle;
  7. import com.badlogic.gdx.math.Circle;
  8. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  9. import com.psillicoder.brickbreaker.Brick;
  10. import java.awt.Point;
  11. import java.awt.Toolkit;
  12. import com.badlogic.gdx.math.Vector2;
  13.  
  14. public class Ball {
  15.         private Texture ballImage;
  16.         public int ballSpeedX;
  17.         public int ballSpeedY;
  18.         public Rectangle ballRect;
  19.        
  20.        
  21.         public Ball(){
  22.         //Load Ball Texture
  23.         ballImage = new Texture(Gdx.files.internal("data/ball.png"));
  24.        
  25.         //Set Ball Speed
  26.         ballSpeedX = 1;
  27.         ballSpeedY = 1;
  28.        
  29.         //Setup initial Rectangle
  30.         ballRect = new Rectangle();
  31.         ballRect.x = 420/2;
  32.         ballRect.y = 600/2;
  33.         ballRect.width = 16;
  34.         ballRect.height = 16;
  35.        
  36.        
  37.        
  38.         }
  39.        
  40.         public Rectangle getRect() {
  41.                 return ballRect;
  42.         }
  43.        
  44.         public void draw(SpriteBatch spritebatch) {
  45.                 spritebatch.draw(ballImage,ballRect.x,ballRect.y);
  46.        
  47.         }
  48.  
  49.        
  50.  
  51.        
  52.        
  53.        
  54.        
  55.        
  56. }
clone this paste RAW Paste Data