comparison game/Engine.java @ 56:8718cc1c6586

Minor bugfixes.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 23 Feb 2011 20:31:39 +0200
parents 974ec36c562e
children 1435e9d7fd1a
comparison
equal deleted inserted replaced
55:974ec36c562e 56:8718cc1c6586
149 nextPiece = new Piece(PieceType.ACTIVE); 149 nextPiece = new Piece(PieceType.ACTIVE);
150 } 150 }
151 151
152 public void pieceSwapCurrent() 152 public void pieceSwapCurrent()
153 { 153 {
154 Piece tmp = currPiece; 154 if (!flagGameOver)
155 currPiece = nextPiece; 155 {
156 nextPiece = tmp; 156 Piece tmp = currPiece;
157 board[currX][currY] = currPiece; 157 currPiece = nextPiece;
158 nextPiece = tmp;
159 board[currX][currY] = currPiece;
160 }
158 } 161 }
159 162
160 public boolean pieceCheck(Piece piece) 163 public boolean pieceCheck(Piece piece)
161 { 164 {
162 if (piece == null) 165 if (piece == null)
163 { 166 {
164 // Create new piece 167 // Create new piece
165 currPiece = new Piece(PieceType.ACTIVE); 168 pieceCreateNew();
166 board[currX][currY] = currPiece; 169 board[currX][currY] = currPiece;
167 return true; 170 return true;
168 } 171 }
169 else 172 else
170 if (piece.getType() == PieceType.START) 173 if (piece.getType() == PieceType.START)
303 catch (FontFormatException e) 306 catch (FontFormatException e)
304 { 307 {
305 System.out.print("Could not initialize fonts.\n"); 308 System.out.print("Could not initialize fonts.\n");
306 } 309 }
307 310
308 musa = soundManager.getSound("sounds/gamemusic.wav"); 311 // musa = soundManager.getSound("sounds/gamemusic.wav");
309 } 312 }
310 catch (IOException e) 313 catch (IOException e)
311 { 314 {
312 JOptionPane.showMessageDialog(null, 315 JOptionPane.showMessageDialog(null,
313 e.getMessage(), 316 e.getMessage(),