Skip to content

Commit

Permalink
Merge pull request #84 from erin330/main
Browse files Browse the repository at this point in the history
TeamHUD display ammo in hard mode
  • Loading branch information
sheenhm authored Oct 20, 2023
2 parents 61bd228 + f299152 commit 2eff9e8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/engine/DrawManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,20 +350,41 @@ public void drawLives2(final Screen screen, final int lives2) {
public void drawItems(final Screen screen, Item[] ItemQ, final int inventory) {
backBufferGraphics.setFont(fontRegular);
backBufferGraphics.setColor(Color.WHITE);
backBufferGraphics.drawString(Integer.toString(inventory), 20, screen.getHeight() + 25);
backBufferGraphics.drawString("ITM: ", 100, screen.getHeight() + 25);
for (int i = 0; i < inventory; i++)
drawEntity(ItemQ[i], 40 + 35 * i, screen.getHeight() + 25);
drawEntity(ItemQ[i], 140 + 25 * i, screen.getHeight() + 17);
}

public void drawItems2(final Screen screen, Item[] ItemQ, final int inventory) {
backBufferGraphics.setFont(fontRegular);
backBufferGraphics.setColor(Color.WHITE);
backBufferGraphics.drawString(Integer.toString(inventory), 120, screen.getHeight() + 25);
backBufferGraphics.drawString("ITM: ", 314, screen.getHeight() + 25);
for (int i = 0; i < inventory; i++)
drawEntity(ItemQ[i], 140 + 35 * i, screen.getHeight() + 25);
drawEntity(ItemQ[i], 354 + 25 * i, screen.getHeight() + 17);
}


/**
* Draws number of items currently in inventory on screen.
*
* @param magazine
* Number of remaining magazines
* @param bullet_count
* Number of bullets fired
* @param screen
* Screen to draw on.
*/
public void drawAmmo(final Screen screen, final int magazine, final int bullet_count) {
backBufferGraphics.setFont(fontRegular);
backBufferGraphics.setColor(Color.WHITE);
backBufferGraphics.drawString("BUL: " + Integer.toString(10-bullet_count) + "/" + Integer.toString(magazine), 10, screen.getHeight() + 25);
}
public void drawAmmo2(final Screen screen, final int magazine2, final int bullet_count2) {
backBufferGraphics.setFont(fontRegular);
backBufferGraphics.setColor(Color.WHITE);
backBufferGraphics.drawString("BUL: " + Integer.toString(10-bullet_count2) + "/" + Integer.toString(magazine2), 224, screen.getHeight() + 25);
}

/**
* Draws a thick line from side to side of the screen.
*
Expand Down
9 changes: 9 additions & 0 deletions src/screen/GameScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,15 @@ else if (this.enemyShipSpecialExplosionCooldown.checkFinished()) {
private void draw() {
drawManager.initDrawing(this);

if (SelectScreen.skillModeOn) {
drawManager.drawAmmo(this, this.magazine, this.bullet_count);

if (this.gameState.getMode() == 2) {
drawManager.drawAmmo2(this, this.magazine2, this.bullet_count2);
}
}


if (this.gameState.getMode() == 1) {
if (this.lives > 0) {
drawManager.drawEntity(this.ship, this.ship.getPositionX(),
Expand Down

0 comments on commit 2eff9e8

Please sign in to comment.