Skip to content

Commit

Permalink
updated paths
Browse files Browse the repository at this point in the history
  • Loading branch information
teogor committed Aug 8, 2020
1 parent 5496464 commit 25bab15
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/app/CBabyBallBounce.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ public class CBabyBallBounce extends JFrame
// path to different assets
private final String IMG_BRICKS = "assets/images/bricks2.jpg"; // path to the brick image
private final String IMG_WHITE_SQUARE = "assets/images/white32x32.jpg"; // path to the white square
private final String IMG_COMPASS_EAST = "assets/images/east.jpg"; // path to the east image - compass
private final String IMG_COMPASS_WEST = "assets/images/west.jpg"; // path to the west image - compass
private final String IMG_COMPASS_NORTH = "assets/images/north.jpg"; // path to the north image - compass
private final String IMG_COMPASS_SOUTH = "assets/images/south.jpg"; // path to the south image - compass
private final String IMG_STEP = "assets/images/step.png"; // path to the step icon
private final String IMG_RUN = "assets/images/run.png"; // path to the run icon
private final String IMG_PAUSE = "assets/images/pause.png"; // path to the pause icon
private final String IMG_RESET = "assets/images/reset.png"; // path to the reset icon
private final String IMG_BALL = "assets/images/ball.png"; // path to the ball icon
private final String IMG_BABY1 = "assets/images/baby1.png"; // path to the baby1 icon
private final String IMG_BABY2 = "assets/images/baby2.png"; // path to the baby2 icon

// integers
private final int rows = 13; // number of rows
Expand Down Expand Up @@ -1059,7 +1070,7 @@ private void createCompass()
compassLabel = new JLabel("");
compassLabel.setBackground(new Color(0, 0, 0, 0));

ImageIcon imageIcon = new ImageIcon("assets/images/east.jpg");
ImageIcon imageIcon = new ImageIcon(IMG_COMPASS_EAST);
Image image = imageIcon.getImage();
Image newimg = image.getScaledInstance(110, 110, Image.SCALE_SMOOTH);
imageIcon = new ImageIcon(newimg);
Expand Down Expand Up @@ -1180,7 +1191,7 @@ private JPanel createGridElementMiddle()
optionItemChoseHolder.setBackground(new Color(255, 255, 255));
optionItemChoseHolder.setPreferredSize(new Dimension(80, 25));
JLabel contentLabel = new JLabel("");
Icon iconAct = new ImageIcon("assets/images/ball.png");
Icon iconAct = new ImageIcon(IMG_BALL);
contentLabel.setIcon(iconAct);
optionItemChoseHolder.add(contentLabel);

Expand Down Expand Up @@ -1211,31 +1222,31 @@ private void ballTo(Directions direction)
switch (direction)
{
case DOWN:
imageIcon = new ImageIcon("assets/images/south.jpg");
imageIcon = new ImageIcon(IMG_COMPASS_SOUTH);
image = imageIcon.getImage();
image = image.getScaledInstance(110, 110, Image.SCALE_SMOOTH);
imageIcon = new ImageIcon(image);
compassLabel.setIcon(imageIcon);
directionLabel.setText("S");
break;
case UP:
imageIcon = new ImageIcon("assets/images/north.jpg");
imageIcon = new ImageIcon(IMG_COMPASS_NORTH);
image = imageIcon.getImage();
image = image.getScaledInstance(110, 110, Image.SCALE_SMOOTH);
imageIcon = new ImageIcon(image);
compassLabel.setIcon(imageIcon);
directionLabel.setText("N");
break;
case LEFT:
imageIcon = new ImageIcon("assets/images/west.jpg");
imageIcon = new ImageIcon(IMG_COMPASS_WEST);
image = imageIcon.getImage();
image = image.getScaledInstance(110, 110, Image.SCALE_SMOOTH);
imageIcon = new ImageIcon(image);
compassLabel.setIcon(imageIcon);
directionLabel.setText("W");
break;
case RIGHT:
imageIcon = new ImageIcon("assets/images/east.jpg");
imageIcon = new ImageIcon(IMG_COMPASS_EAST);
image = imageIcon.getImage();
image = image.getScaledInstance(110, 110, Image.SCALE_SMOOTH);
imageIcon = new ImageIcon(image);
Expand Down Expand Up @@ -1313,7 +1324,7 @@ private void prepareButtons()
private void loadActBtn()
{

Icon iconAct = new ImageIcon("assets/images/step.png");
Icon iconAct = new ImageIcon(IMG_STEP);
JButton btnAct = createButton(iconAct, "Act");
btnAct.addActionListener(actionEvent ->
{
Expand All @@ -1329,18 +1340,18 @@ private void loadActBtn()
private void loadStateBtn()
{

Icon iconAct = new ImageIcon("assets/images/run.png");
Icon iconAct = new ImageIcon(IMG_RUN);
btnState = createButton(iconAct, "Run");
btnState.addActionListener(actionEvent ->
{

if (!isGameStarted())
{
btnState.setIcon(new ImageIcon("assets/images/pause.png"));
btnState.setIcon(new ImageIcon(IMG_PAUSE));
btnState.setText("Pause");
} else
{
btnState.setIcon(new ImageIcon("assets/images/run.png"));
btnState.setIcon(new ImageIcon(IMG_RUN));
btnState.setText("Run");
}
changeGameState();
Expand All @@ -1352,12 +1363,12 @@ private void loadStateBtn()
private void loadResetBtn()
{

Icon iconAct = new ImageIcon("assets/images/reset.png");
Icon iconAct = new ImageIcon(IMG_RESET);
JButton btnReset = createButton(iconAct, "Reset");
btnReset.addActionListener(actionEvent ->
{
resetSeconds();
btnState.setIcon(new ImageIcon("assets/images/run.png"));
btnState.setIcon(new ImageIcon(IMG_RUN));
btnState.setText("Run");
});
gameControls.add(btnReset);
Expand Down Expand Up @@ -1394,7 +1405,6 @@ private JFrame getAppWindow()
return mainActivityGlobal;
}


private void addOnTeamMembersListener(TeamMembersNumber teamMembersNumber)
{
mTeamMembersNumber = teamMembersNumber;
Expand All @@ -1421,15 +1431,14 @@ private int getNoPlayers()
return 2;
}


private void initializePlayers()
{
ImageIcon imageIcon1 = new ImageIcon("assets/images/baby1.png");
ImageIcon imageIcon1 = new ImageIcon(IMG_BABY1);
Image image1 = imageIcon1.getImage();
Image newimg1 = image1.getScaledInstance(31, 31, Image.SCALE_SMOOTH);
imageIcon1 = new ImageIcon(newimg1);

ImageIcon imageIcon2 = new ImageIcon("assets/images/baby2.png");
ImageIcon imageIcon2 = new ImageIcon(IMG_BABY2);
Image image2 = imageIcon2.getImage();
Image newimg2 = image2.getScaledInstance(31, 31, Image.SCALE_SMOOTH);
imageIcon2 = new ImageIcon(newimg2);
Expand Down Expand Up @@ -1460,10 +1469,9 @@ private Directions getBallDirection()
return ballDirection;
}


private void initializeBall()
{
ImageIcon imageIcon = new ImageIcon("assets/images/ball.png");
ImageIcon imageIcon = new ImageIcon(IMG_BALL);
Image image = imageIcon.getImage();
Image newimg = image.getScaledInstance(23, 23, Image.SCALE_SMOOTH);
imageIcon = new ImageIcon(newimg);
Expand All @@ -1475,7 +1483,6 @@ private Ball getBall()
return mBall;
}


private void increaseSeconds()
{
seconds++;
Expand Down Expand Up @@ -1514,7 +1521,6 @@ private int getSeconds()
return seconds;
}


private void changeGameState()
{
gameStarted = !gameStarted;
Expand All @@ -1529,13 +1535,11 @@ private boolean isGameStarted()
return gameStarted;
}


private void addOnTimerCallback(GameStarted gameStarted)
{
mGameStarted = gameStarted;
}


private void addOnAutoMoveBallCallback(AutoMoveBall autoMoveBall)
{
mAutoMoveBall = autoMoveBall;
Expand All @@ -1546,7 +1550,6 @@ private AutoMoveBall getAutoMoveBall()
return mAutoMoveBall;
}


private int getGameSpeed()
{
return gameSpeed;
Expand All @@ -1561,7 +1564,6 @@ private void setGameSpeed(int speed)
}
}


private void addOnGameSpeedCallback(GameSpeed gameSpeed)
{
mGameSpeedCallback = gameSpeed;
Expand All @@ -1586,7 +1588,6 @@ private BallSquare getBallSquare()
return mBallSquare;
}


private void addGoalScoredCallback(GoalScored goalScored)
{
mGoalScored = goalScored;
Expand Down

0 comments on commit 25bab15

Please sign in to comment.