Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. package pong;
  2.  
  3. import java.awt.Rectangle;
  4.  
  5. public class PongBall extends Thread{
  6.    
  7.     int x,y,tempX,tempY,width,height,speedX,speedY;
  8.     boolean paused;
  9.  
  10.     public PongBall(int x, int y, int width, int height, int speedX, int speedY){
  11.         this.x = x;
  12.         this.y = y;
  13.         this.width = width;
  14.         this.height = height;
  15.         this.speedX = speedX;
  16.         this.speedY = speedY;
  17.         tempX = x;
  18.         tempY = y;
  19.        
  20.         paused = false;
  21.     }
  22.    
  23.     public int getX(){
  24.         return x;
  25.     }
  26.    
  27.     public int getY(){
  28.         return y;
  29.     }
  30.    
  31.     public int getWidth(){
  32.         return width;
  33.     }
  34.    
  35.     public int getHeight(){
  36.         return height;
  37.     }
  38.    
  39.     public int getSpeedX(){
  40.         return speedX;
  41.     }
  42.    
  43.     public int getSpeedY(){
  44.         return speedY;
  45.     }
  46.    
  47.     public void setX(int x){
  48.         this.x = x;
  49.     }
  50.    
  51.     public void setY(int y){
  52.         this.y = y;
  53.     }
  54.    
  55.     public void setWidth(int width){
  56.         this.width = width;
  57.     }
  58.    
  59.     public void setHeight(int height){
  60.         this.height = height;
  61.     }
  62.    
  63.     public void setSpeedX(int speedX){
  64.         this.speedX = speedX;
  65.     }
  66.    
  67.     public void setSpeedY(int speedY){
  68.         this.speedY = speedY;
  69.     }
  70.    
  71.     public void stopBall(){
  72.         speedX = 0;
  73.         speedY = 0;
  74.     }
  75.    
  76.     public Rectangle getBounds(){
  77.         return new Rectangle(getX(),getY(),getWidth(),getHeight());
  78.     }
  79.    
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement