Guest User

Untitled

a guest
Jul 15th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public void turnRight() {
  2. if(this.direction > 3)
  3. this.direction = 0;
  4. //direction = (direction + 1)%4;
  5. }
  6.  
  7. /**
  8. * public Ghost copy() {
  9. * Creates a new ghost object that is identical to this Ghost
  10. * i.e. same position, color and direction.
  11. * @return a copy of this ghost
  12. */
  13. public Ghost copy(){
  14. Ghost newGhost = new Ghost();
  15. newGhost.x = this.x;
  16. newGhost.y = this.y;
  17. newGhost.color = this.color;
  18. newGhost.direction = this.direction;
  19. return newGhost;
  20. }
Add Comment
Please, Sign In to add comment