Advertisement
Guest User

Player.java

a guest
May 18th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package game.pong;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5.  
  6. public class Player {
  7.    
  8.     private int y = Game.HEIGHT / 2;
  9.    
  10.     private int yVelocity = 0;
  11.    
  12.     public int score = 0;
  13.    
  14.     private int width = 15;
  15.     private int height = 60;
  16.    
  17.     public Player(){
  18.        
  19.     }
  20.    
  21.     public void update(){
  22.         y = y + yVelocity;
  23.        
  24.         System.out.println(y);
  25.     }
  26.    
  27.     public void paint(Graphics g){
  28.         g.setColor(Color.BLUE);
  29.         g.fillRect(50, y, width, height);
  30.     }
  31.    
  32.     public void setVelocity(int speed){
  33.         yVelocity = speed;
  34.     }
  35.  
  36.     public int getX() {
  37.         return 15;
  38.     }
  39.  
  40.     public int getY() {
  41.         return y;
  42.     }
  43.    
  44.     public int getWidth(){     
  45.         return width;
  46.     }
  47.    
  48.     public int getHeight(){
  49.         return height;
  50.     }
  51.    
  52.     public int getScore(){
  53.         return score;
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement