Skip to content

Commit ad8ae47

Browse files
committed
refactor: update power-up names, adjust ball speed and imply BGM toggle
- Reduced default ball speed from 2000.0 to 1000.0. - Added method to check if any sound is playing in SoundManager. - Updated GameOverScreen to launch MainMenuScreen instead of going back to the previous screen. - Adjustment to only update game in GameScreen when deltatime is not zero (when in pause state)
1 parent f312e50 commit ad8ae47

File tree

15 files changed

+151
-100
lines changed

15 files changed

+151
-100
lines changed

client/src/main/java/io/exterminator3618/client/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Constants {
2929
/**
3030
* Default ball speed.
3131
*/
32-
public static double BALL_SPEED = 2000.0;
32+
public static double BALL_SPEED = 1000.0;
3333
/**
3434
* Ball collision tolerance.
3535
*/

client/src/main/java/io/exterminator3618/client/Exterminator3618.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public void backToPreviousScreen () {
100100
return;
101101
}
102102
screenStack.pop();
103+
screenStack.peek().show();
103104
if (screenStack.isEmpty()) {
104105
log.warn("Popped the last screen, quiting game.");
105106
Gdx.app.exit();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.exterminator3618.client;
2+
3+
public class Settings {
4+
public static boolean enableMusic = true;
5+
}

client/src/main/java/io/exterminator3618/client/components/ExtraLifePowerUp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
public class ExtraLifePowerUp extends PowerUp {
77

88
public ExtraLifePowerUp(int x, int y) {
9-
super("extra_life_power_up", 0.0f , x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "extra_life_power_up");
9+
super("Extra Life", 0.0f , x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "extra_life_power_up");
1010
}
1111

1212
@Override

client/src/main/java/io/exterminator3618/client/components/HeavyBallPowerUp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class HeavyBallPowerUp extends PowerUp {
1111

1212
public HeavyBallPowerUp(int x, int y) {
13-
super("heavy_ball_power_up", 5.0f, x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "heavy_ball_power_up");
13+
super("Heavy Ball", 5.0f, x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "heavy_ball_power_up");
1414
}
1515

1616
@Override

client/src/main/java/io/exterminator3618/client/components/SlowBallPowerUp.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
public class SlowBallPowerUp extends PowerUp {
77

88
public SlowBallPowerUp(int x, int y) {
9-
super("slow_ball_power_up", 20.0f, x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "slow_ball_power_up");
9+
super("Slow Ball", 20.0f, x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "slow_ball_power_up");
1010
}
1111

1212
@Override
@@ -25,4 +25,5 @@ public void removeEffect (GameScreen gameScreen){
2525
gameScreen.getBall().updateVelocity();
2626
}
2727
}
28+
2829
}

client/src/main/java/io/exterminator3618/client/components/SplitBallPowerUp.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public class SplitBallPowerUp extends PowerUp {
1010

1111
public SplitBallPowerUp(int x, int y) {
12-
super("split_ball_power_up", 0.0f , x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "split_ball_power_up");
12+
super("Split Ball", 0.0f , x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "split_ball_power_up");
1313
}
1414

1515
@Override
@@ -31,4 +31,6 @@ public void removeEffect(GameScreen gameScreen) {
3131
// No-op: this is an instant effect power-up
3232
}
3333

34+
35+
3436
}

client/src/main/java/io/exterminator3618/client/components/StickyPaddlePowerUp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class StickyPaddlePowerUp extends PowerUp {
1111

1212
public StickyPaddlePowerUp(int x, int y) {
13-
super("sticky_paddle_power_up", 10.0f, x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "sticky_paddle_power_up");
13+
super("Sticky Paddle", 10.0f, x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "sticky_paddle_power_up");
1414
}
1515

1616
@Override

client/src/main/java/io/exterminator3618/client/components/WidenPaddlePowerUp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class WidenPaddlePowerUp extends PowerUp {
1111

1212
public WidenPaddlePowerUp(int x, int y) {
13-
super("widen_paddle_power_up", 10.0f, x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "extend_paddle_power_up");
13+
super("Widen Paddle", 10.0f, x, y, Constants.POWERUP_WIDTH, Constants.POWERUP_HEIGHT, "extend_paddle_power_up");
1414
}
1515

1616
@Override

client/src/main/java/io/exterminator3618/client/managers/SoundManager.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package io.exterminator3618.client.managers;
22

3-
import com.badlogic.gdx.Gdx;
4-
import com.badlogic.gdx.audio.Music;
5-
import com.badlogic.gdx.audio.Sound;
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
66
import org.slf4j.Logger;
77
import org.slf4j.LoggerFactory;
88

9-
import java.util.HashMap;
10-
import java.util.Map;
9+
import com.badlogic.gdx.Gdx;
10+
import com.badlogic.gdx.audio.Music;
11+
import com.badlogic.gdx.audio.Sound;
1112

1213
/**
1314
* Quản lý âm thanh đơn giản cho game.

0 commit comments

Comments
 (0)