HUD improved

This commit is contained in:
Andreas Greiner 2021-06-25 22:21:23 +02:00
parent 64b8d620e4
commit 4e1b6ff6ba
47 changed files with 57 additions and 30 deletions

View File

@ -76,6 +76,7 @@ public class GamePlayManager {
System.exit(-1); System.exit(-1);
} }
player = new Player(level); player = new Player(level);
player.score = 1000000;
gameObjectManager.getPlayerObject().setGamePlayManager(this); gameObjectManager.getPlayerObject().setGamePlayManager(this);
} }

View File

@ -69,7 +69,7 @@ public class LevelManager {
private List<String> loadBackgroundImages(){ private List<String> loadBackgroundImages(){
List<String> images = new ArrayList<>(); List<String> images = new ArrayList<>();
for(int i=1;i<=BACKGROUND_IMAGE_COUNT;i++){ for(int i=1;i<=BACKGROUND_IMAGE_COUNT;i++){
images.add("backgrounds/background_"+i+".png"); images.add("background_"+i+".png");
} }
return images; return images;
} }

View File

@ -137,9 +137,7 @@ public abstract class Bubble extends CollidingGameObject implements MovingGameOb
* *
* @return the score to add * @return the score to add
*/ */
public int getBurstScore(){ public abstract int getBurstScore();
return (int)(size*1000);
}
/** /**
* Get the size of the bubble. * Get the size of the bubble.

View File

@ -20,7 +20,7 @@ public class Background extends GameObject {
this.position.setTo(0,0); this.position.setTo(0,0);
size = 1; size = 1;
rotation = 0; rotation = 0;
backgroundImage = "backgrounds/background_1.png"; backgroundImage = "background_1.png";
} }
@Override @Override

View File

@ -20,11 +20,11 @@ public class LevelLabel extends GameObject {
*/ */
public LevelLabel(GameView gameView){ public LevelLabel(GameView gameView){
super(gameView); super(gameView);
size = 3; size = 1;
width = 101; width = 109;
height = 8; height = 8;
level = 1; level = 1;
getPosition().setTo(GameView.WIDTH/2.0 - (width/2.0),GameView.HEIGHT-height-60); getPosition().setTo(GameView.WIDTH/2.0 - width,GameView.HEIGHT-height-60);
} }
/** /**

View File

@ -24,7 +24,7 @@ public class LevelProgressBar extends GameObject {
width = 101; width = 101;
height = 8; height = 8;
levelProgress = 0; levelProgress = 0;
getPosition().setTo(GameView.WIDTH/2.0 - (width/2.0),GameView.HEIGHT-(height*size)); getPosition().setTo(GameView.WIDTH/2.0 - width,GameView.HEIGHT-(height*size));
} }
/** /**

View File

@ -8,17 +8,7 @@ import de.thdeg.greiner.superpangworld.graphics.base.GameObject;
*/ */
public class LivesLabel extends GameObject { public class LivesLabel extends GameObject {
private final static String ICON = /** Lives count */
" RR RR \n"+
" RRRR RRRR \n"+
"RRRRRRRRRRR\n"+
"RRRRRRRRRRR\n"+
" RRRRRRRRR \n"+
" RRRRRRR \n"+
" RRRRR \n"+
" RRR \n"+
" R \n";
private int lifeCount; private int lifeCount;
/** /**
@ -29,19 +19,19 @@ public class LivesLabel extends GameObject {
public LivesLabel(GameView gameView) { public LivesLabel(GameView gameView) {
super(gameView); super(gameView);
rotation = 0; rotation = 0;
size = 5; size = 2;
width = 12; width = (int) size * 12;
height = 12; height = (int) size * 12;
this.lifeCount = 0; this.lifeCount = 0;
position.setTo(0,GameView.HEIGHT-50); position.setTo(10,GameView.HEIGHT - height - 5);
} }
@Override @Override
public void addToCanvas() { public void addToCanvas() {
for(int i=0;i<lifeCount;i++){ for(int i=0;i<lifeCount;i++){
gameView.addBlockImageToCanvas(ICON,position.x + (i*size*width),position.y,size,rotation); gameView.addImageToCanvas("livesIcon.png",position.x + (i*size*width),position.y,size,rotation);
} }
} }

View File

@ -21,16 +21,16 @@ public class ScoreLabel extends GameObject {
public ScoreLabel(GameView gameView) { public ScoreLabel(GameView gameView) {
super(gameView); super(gameView);
score = 0; score = 0;
size = 50; size = 1;
width = 100; width = (int) size * 100;
height = 8; height = (int) size * 8;
position.setTo(GameView.WIDTH/2 - (width/2) -250,GameView.HEIGHT-height-60); position.setTo(0,GameView.HEIGHT-height-60);
} }
@Override @Override
public void addToCanvas() { public void addToCanvas() {
gameView.addTextToCanvas(Integer.toString(score),getPosition().x,getPosition().y,40, Color.YELLOW,0); gameView.addTextToCanvas(Integer.toString(score),getPosition().x,getPosition().y,30, Color.YELLOW,0);
} }
/** /**

View File

@ -66,6 +66,23 @@ public class HexagonalBubble extends Bubble {
rotation = (rotation + 1) % 360; rotation = (rotation + 1) % 360;
} }
@Override
public int getBurstScore() {
// 1 0.5 0.25 0.125
switch((int)(size*1000)){
case 1000:
return 200;
case 500:
return 400;
case 250:
return 600;
case 125:
return 1200;
default:
throw new RuntimeException();
}
}
@Override @Override
public void destroy() { public void destroy() {
gameView.playSound("burst.wav",false); gameView.playSound("burst.wav",false);

View File

@ -131,6 +131,22 @@ public class RoundBubble extends Bubble {
} }
} }
@Override
public int getBurstScore() {
switch((int)(size*100)){
case 1000:
return 100;
case 500:
return 200;
case 250:
return 300;
case 125:
return 400;
default:
throw new RuntimeException();
}
}
@Override @Override
public void updateStatus() { public void updateStatus() {

View File

@ -115,6 +115,11 @@ public class SpecialBubble extends Bubble {
} }
@Override
public int getBurstScore() {
return 1000;
}
@Override @Override
public void updateStatus() {} public void updateStatus() {}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B