feat: music & sound!!!
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package eu.midnightdust.yaytris.game;
|
||||
|
||||
import eu.midnightdust.yaytris.Tetris;
|
||||
import eu.midnightdust.yaytris.util.SoundEffect;
|
||||
import eu.midnightdust.yaytris.util.Vec2i;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -20,6 +21,7 @@ public class Tetromino {
|
||||
public void fall(int length) {
|
||||
Vec2i newPos = centerPos.offset(Vec2i.of(0, length));
|
||||
if (collidesVertically(newPos)) {
|
||||
SoundEffect.BEEP.play();
|
||||
int[] affectedLines = new int[this.collision.length];
|
||||
int line = centerPos.getY();
|
||||
for (int i = 0; i < this.collision.length; i++) {
|
||||
@@ -27,6 +29,7 @@ public class Tetromino {
|
||||
line++;
|
||||
}
|
||||
Tetris.getSpace().onLinesChanged(this, affectedLines);
|
||||
Tetris.getSpace().increaseScore(20-fallLength);
|
||||
if (fallLength >= 1) Tetris.getSpace().spawnTetromino();
|
||||
else Tetris.stopGame();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user