Skip to content

Commit b43bf77

Browse files
committed
Merge branch 'master' into im-yuuki-patch-2
# Conflicts: # client/src/main/java/io/exterminator3618/client/screens/GameScreen.java
2 parents 9f43580 + b676f28 commit b43bf77

File tree

10 files changed

+137
-239
lines changed

10 files changed

+137
-239
lines changed

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

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ public class Constants {
3636
public static final double MAX_BOUNCE_ANGLE = 65;
3737
public static final double BALL_EPSILON = 50;
3838

39-
/**
40-
* Audio file paths.
41-
*/
42-
public static final String TEST_LONG_MUSIC_2 = "sound/test_bgr2.wav";
43-
public static final String BACKGROUND_MUSIC = "sound/test_bgr.mp3";
44-
public static final String BUFF_SOUND = "sound/buff_sound.mp3";
45-
4639
/**
4740
* Path to backgounds
4841
*/
@@ -56,27 +49,10 @@ public class Constants {
5649
/**
5750
* Brick texture region names.
5851
*/
59-
public static final String NORMAL_BLUE_BRICK = "normal_blue_brick";
6052
public static final String NORMAL_GREEN_BRICK = "normal_green_brick";
6153
public static final String NORMAL_ORANGE_BRICK = "normal_orange_brick";
62-
public static final String NORMAL_PURPLE_BRICK = "normal_purple_brick";
63-
public static final String NORMAL_RED_BRICK = "normal_red_brick";
6454
public static final String NORMAL_YELLOW_BRICK = "normal_yellow_brick";
65-
66-
public static final String SQUARE_BLUE_BRICK = "square_blue_brick";
67-
public static final String SQUARE_GREEN_BRICK = "square_green_brick";
68-
public static final String SQUARE_ORANGE_BRICK = "square_orange_brick";
69-
public static final String SQUARE_PURPLE_BRICK = "square_purple_brick";
70-
public static final String SQUARE_RED_BRICK = "square_red_brick";
71-
public static final String SQUARE_YELLOW_BRICK = "square_yellow_brick";
72-
7355
public static final String THICK_BLUE_BRICK = "thick_blue_brick";
74-
public static final String THICK_GREEN_BRICK = "thick_green_brick";
75-
public static final String THICK_ORANGE_BRICK = "thick_orange_brick";
76-
public static final String THICK_PURPLE_BRICK = "thick_purple_brick";
77-
public static final String THICK_RED_BRICK = "thick_red_brick";
78-
public static final String THICK_YELLOW_BRICK = "thick_yellow_brick";
79-
8056
public static final String MULTIBALL_BRICK = "normal_purple_brick";
8157
/**
8258
* Brick dimensions and layout.
@@ -85,8 +61,7 @@ public class Constants {
8561
public static final int BRICK_HEIGHT = 32;
8662
public static final int BRICK_SPACING = 5;
8763
public static final int BRICK_START_X = 80;
88-
public static final int BRICK_START_Y = 100;
89-
public static final int BRICK_ROW_HEIGHT = BRICK_HEIGHT;
64+
public static final int BRICK_START_Y = 120;
9065

9166
/**
9267
* Paddle dimensions and layout.
@@ -96,28 +71,13 @@ public class Constants {
9671
public static final int PADDLE_START_X = WINDOW_WIDTH / 2 - PADDLE_WIDTH / 2;
9772
public static final int PADDLE_START_Y = 100;
9873
public static final String PADDLE_REGION_NAME = "red_paddle";
99-
public static final int PADDLE_SPEED = 900;
100-
101-
public enum GameState {
102-
MENU,
103-
PLAYING,
104-
PAUSED,
105-
GAME_OVER,
106-
VICTORY,
107-
LOSE
108-
}
10974

11075
/**
11176
* FOR POWERUP
11277
*/
11378
public static final int POWERUP_WIDTH = 32;
11479
public static final int POWERUP_HEIGHT = 32;
115-
public static final double POWERUP_FALL_SPEED = 1000.0;
116-
// PowerUp texture regions
117-
public static final String POWERUP_BALLS_FROM_PADDLE = "big_purple_ball"; //KHÔNG CÓ ASSET POWERUP, DÙNG TẠM
118-
119-
// PowerUp duration constants
120-
public static final float WIDEN_PADDLE_DURATION = 5.0f; // 5 seconds
80+
public static final float POWERUP_FALL_SPEED = 200.0f;
12181

12282
public static final String BUTTON_LEFT_REGION = "tile_82";
12383
public static final String BUTTON_MIDDLE_REGION = "tile_83";

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public void resetToCenter(Paddle paddle) {
7070
isStuckToPaddle = true;
7171
stuckOffsetX = 0; // Reset offset to center
7272
setVelocity(0,0);
73+
7374
}
7475

7576
/**

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

Lines changed: 0 additions & 82 deletions
This file was deleted.

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", 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_live_power_up");
1010
}
1111

1212
@Override

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
import static java.lang.Math.random;
44

5+
import static io.exterminator3618.client.Constants.POWERUP_FALL_SPEED;
56
import io.exterminator3618.client.screens.GameScreen;
67

78
public abstract class PowerUp extends MovableObject {
89
private String type;
910
private float duration;
1011
private float remainingDuration;
11-
private float fallSpeed = 200f;
12+
private final float fallSpeed = POWERUP_FALL_SPEED;
1213

1314
public PowerUp(String type, float duration, int x, int y, int width, int height, String regionName) {
1415
super(x, y, width, height, regionName);
@@ -57,7 +58,11 @@ public void update(float deltaTime) {
5758
}
5859

5960
public static PowerUp createRandomPowerUp(int x, int y){
60-
switch ((int) (random() * 6)) {
61+
62+
int randomIndex = (int) (random() * 6);
63+
64+
65+
switch (randomIndex) {
6166
case 0:
6267
return new WidenPaddlePowerUp(x, y);
6368
case 1:
@@ -71,7 +76,8 @@ public static PowerUp createRandomPowerUp(int x, int y){
7176
case 5:
7277
return new SlowBallPowerUp(x, y);
7378
default:
74-
return null;
79+
// Safety fallback
80+
return new WidenPaddlePowerUp(x, y);
7581
}
7682
}
7783

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ public class PowerUpBrick extends Brick {
1515
* @param y initial Y position in pixels
1616
*/
1717
public PowerUpBrick(int x, int y) {
18-
super(x, y, Constants.BRICK_WIDTH, Constants.BRICK_HEIGHT, Constants.NORMAL_YELLOW_BRICK, 1, "powerup_widen_paddle");
18+
super(x, y, Constants.BRICK_WIDTH, Constants.BRICK_HEIGHT, Constants.NORMAL_YELLOW_BRICK, 1, "powerup_brick");
1919
}
2020
}

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", 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, "expand_paddle_power_up");
1414
}
1515

1616
@Override

0 commit comments

Comments
 (0)