Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void turnRight() {
- if(this.direction > 3)
- this.direction = 0;
- //direction = (direction + 1)%4;
- }
- /**
- * public Ghost copy() {
- * Creates a new ghost object that is identical to this Ghost
- * i.e. same position, color and direction.
- * @return a copy of this ghost
- */
- public Ghost copy(){
- Ghost newGhost = new Ghost();
- newGhost.x = this.x;
- newGhost.y = this.y;
- newGhost.color = this.color;
- newGhost.direction = this.direction;
- return newGhost;
- }
Add Comment
Please, Sign In to add comment