From 017e24a484e33ff521bb7d489bfdddcf65309dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bokros=20B=C3=A1lint?= Date: Tue, 29 Mar 2016 00:51:26 +0200 Subject: [PATCH] added rotateLeft and rotateRight methods to ONeill --- cicaprojekt/ONeill.java | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/cicaprojekt/ONeill.java b/cicaprojekt/ONeill.java index 8922a19..fd8c887 100644 --- a/cicaprojekt/ONeill.java +++ b/cicaprojekt/ONeill.java @@ -50,7 +50,40 @@ public class ONeill implements Destroyable{ System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.boxLift()"); Menu.removeTab(); boxLifted = (Box) currentTile.getAdjacentTile(facingDirection).removeItemFromTile(); - + } + + public void rotateLeft() { + switch (facingDirection) { + case NORTH: + facingDirection = Direction.WEST; + break; + case WEST: + facingDirection = Direction.SOUTH; + break; + case SOUTH: + facingDirection = Direction.EAST; + break; + case EAST: + facingDirection = Direction.NORTH; + break; + } + } + + public void rotateRight() { + switch (facingDirection) { + case NORTH: + facingDirection = Direction.EAST; + break; + case EAST: + facingDirection = Direction.SOUTH; + break; + case SOUTH: + facingDirection = Direction.WEST; + break; + case WEST: + facingDirection = Direction.NORTH; + break; + } } public void boxDrop() {