Mercurial > hg > ristipolku
changeset 35:aa15b2c556b4
Add comments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 17 Feb 2011 03:40:01 +0200 |
parents | 6f6c551cc14c |
children | a43587e14485 |
files | game/Engine.java |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/game/Engine.java Thu Feb 03 20:37:34 2011 +0200 +++ b/game/Engine.java Thu Feb 17 03:40:01 2011 +0200 @@ -231,8 +231,10 @@ public void pieceFinishTurn() { + // Do we have a piece? if (current != null) { + // Yes, place and lock it current.setType(PieceType.LOCKED); PathInfo i = resolvePath(moveX, moveY, movePoint, true); @@ -246,18 +248,24 @@ } } + // Create a new piece current = new Piece(PieceType.ACTIVE); + + // Find a place for it if (isEmpty(moveX, moveY)) { + // Current position is empty, use it board[moveX][moveY] = current; } else { + // Resolve path PathInfo i = resolvePath(moveX, moveY, movePoint, true); if (i != null) board[moveX][moveY] = current; else { + // Path ended up center/gameboard walls - it's game over, man System.out.print("pieceFinishTurn(): Game Over!\n"); flagGameOver = true; } @@ -465,6 +473,9 @@ snd(Sound.PIECE_PLACED).stop(); snd(Sound.PIECE_PLACED).play(); break; + + case KeyEvent.VK_ESCAPE: + break; } }