Mercurial > hg > ristipolku
comparison game/Engine.java @ 106:41c6cca69d60
Make new pieces appear gradually, and same effect for swapping.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 03 Mar 2011 21:21:35 +0200 |
parents | 75015dfd47ef |
children | ae66d21d4747 |
comparison
equal
deleted
inserted
replaced
105:75015dfd47ef | 106:41c6cca69d60 |
---|---|
306 } | 306 } |
307 | 307 |
308 public void pieceCreateNew() | 308 public void pieceCreateNew() |
309 { | 309 { |
310 currPiece = nextPiece; | 310 currPiece = nextPiece; |
311 currPiece.changed(); | |
311 nextPiece = new Piece(PieceType.ACTIVE); | 312 nextPiece = new Piece(PieceType.ACTIVE); |
312 } | 313 } |
313 | 314 |
314 public void pieceSwapCurrent() | 315 public void pieceSwapCurrent() |
315 { | 316 { |
317 { | 318 { |
318 Piece tmp = currPiece; | 319 Piece tmp = currPiece; |
319 currPiece = nextPiece; | 320 currPiece = nextPiece; |
320 nextPiece = tmp; | 321 nextPiece = tmp; |
321 board[currX][currY] = currPiece; | 322 board[currX][currY] = currPiece; |
323 currPiece.changed(); | |
324 nextPiece.changed(); | |
322 } | 325 } |
323 } | 326 } |
324 | 327 |
325 // Check one piece, set connections, find the new placement | 328 // Check one piece, set connections, find the new placement |
326 // based on piece rotations etc. | 329 // based on piece rotations etc. |
469 { | 472 { |
470 // Initialize globals | 473 // Initialize globals |
471 System.out.print("Engine() constructor\n"); | 474 System.out.print("Engine() constructor\n"); |
472 | 475 |
473 // Sound system | 476 // Sound system |
474 G.smgr = new SoundManager(new AudioFormat(22050, 16, 1, true, false), 2); | 477 G.smgr = new SoundManager(new AudioFormat(22050, 16, 1, true, false), 1); |
475 | 478 |
476 // Load resources | 479 // Load resources |
477 try | 480 try |
478 { | 481 { |
479 ResourceLoader res = new ResourceLoader("graphics/board.jpg"); | 482 ResourceLoader res = new ResourceLoader("graphics/board.jpg"); |