feat: add line completed sound
This commit is contained in:
@@ -28,10 +28,6 @@ public class Tetris {
|
||||
ui = new TetrisUI();
|
||||
}
|
||||
|
||||
public static TetrisUI getUi() {
|
||||
return ui;
|
||||
}
|
||||
|
||||
public static Space getSpace() {
|
||||
return space;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package eu.midnightdust.yaytris.game;
|
||||
|
||||
import eu.midnightdust.yaytris.Tetris;
|
||||
import eu.midnightdust.yaytris.util.SoundEffect;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.*;
|
||||
@@ -76,6 +77,7 @@ public class Space {
|
||||
combo *= completedLines.size();
|
||||
}
|
||||
}
|
||||
if (!completedLines.isEmpty()) SoundEffect.LINE_COMPLETED.play();
|
||||
for (int completedIndex = 0; completedIndex < completedLines.size(); completedIndex++) { // Remove completed lines
|
||||
int line = completedLines.toArray(new Integer[0])[completedIndex];
|
||||
for (int i = line; i >= 0; i--) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Tetromino {
|
||||
public boolean fall() {
|
||||
Vec2i newPos = centerPos.offset(Vec2i.of(0, 1));
|
||||
if (collidesVertically(newPos)) {
|
||||
SoundEffect.BEEP.play();
|
||||
SoundEffect.BOOP.play();
|
||||
int[] affectedLines = new int[this.collision.length];
|
||||
int line = centerPos.getY();
|
||||
for (int i = 0; i < this.collision.length; i++) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package eu.midnightdust.yaytris.util;
|
||||
|
||||
public enum SoundEffect {
|
||||
BEEP("/sounds/beep.wav");
|
||||
BOOP("/sounds/boop.wav"), LINE_COMPLETED("/sounds/line-completed.wav");
|
||||
|
||||
final String location;
|
||||
SoundEffect(String location) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"musicVolume": 100,
|
||||
"musicVolume": 25,
|
||||
"soundVolume": 100,
|
||||
"guiScale": 5.0,
|
||||
"difficulty": "NORMAL"
|
||||
|
||||
Reference in New Issue
Block a user