Guest User

Pac

a guest
Jun 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1.  
  2. class Pacman extends Creature {
  3.  
  4.    int score;
  5.    int[] orientations = {1, 2, 3, 4};
  6.    // 1 = up, 2 = down, 3 = left,4 = right
  7.  
  8.  
  9.   public Pacman() {
  10.     putSelfInGrid();
  11.   }
  12.  
  13.  
  14.      public int xPixel () {
  15.       return c * 16  + 8;
  16.     }
  17.     public int yPixel () {
  18.       return r * 16 + 8;
  19.     }
  20.    
  21.  
  22.   public int getR() { return r; }
  23.   public int getC() { return c; }
  24.  
  25.  
  26.    public void moveTo(Location l) {
  27.      maze[r][c].setOccupied(false);
  28.      r = l.getR();
  29.      c = l.getC();
  30.      maze[r][c].setOccupied(true);
  31.    }
  32.    
  33.    public Location getLocation () {
  34.      return maze[r][c];
  35.    }
  36.  
  37.     public void putSelfInGrid() {
  38.        c = 13;
  39.        r = 26;
  40.        maze[26][13].setOccupied(true);
  41.     }
  42.    
  43.  
  44.     public void setScore (int score) {
  45.       this.score = score;
  46.     }
  47.    
  48.     public int getScore () { return score; }
  49.    
  50.  
  51.     public void removeSelfFromGrid() {}
  52.    
  53.     public void beEaten() {}
  54.    
  55. }
Add Comment
Please, Sign In to add comment