Skip to content

Commit

Permalink
add sprite for each item in the list to item shop.
Browse files Browse the repository at this point in the history
  • Loading branch information
josia-santoso committed Oct 21, 2023
1 parent d93e9d2 commit f8c88bf
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/engine/DrawManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,18 @@ public void drawItemShopMenu(final Screen screen,final int selectedItem) {
int startX = screen.getWidth() / 10; // Starting X position for the first item
int itemWidth = 100; // Width of each item box
int spacing = 20; // Horizontal spacing
int itemX1 = startX;
int itemX2 = startX + itemWidth + spacing;
int itemX3 = startX + 2 * (itemWidth + spacing);
Ship SpeedUpItem = new Ship(0, 0, Color.orange, SpriteType.SpeedUpShape, false);
Ship BulletItem = new Ship(0, 0, Color.orange, SpriteType.Bullet, false);

drawEntity(new Ship(0, 0, Color.RED, SpriteType.Life, false),itemX2+45, screen.getHeight() / 2-5);
drawEntity(SpeedUpItem, itemX1+45, screen.getHeight() / 2-5);
drawEntity(BulletItem, itemX3+48, screen.getHeight() / 2-5);

// Draw the first item
int itemX1 = startX;

if (selectedItem == 70) {
backBufferGraphics.setColor(Color.GREEN);
} else {
Expand All @@ -739,7 +748,7 @@ public void drawItemShopMenu(final Screen screen,final int selectedItem) {
backBufferGraphics.drawString(priceText1, priceX1, screen.getHeight() / 2 + 90);

// Draw the second item
int itemX2 = startX + itemWidth + spacing;

if (selectedItem == 71) {
backBufferGraphics.setColor(Color.GREEN);
} else {
Expand All @@ -758,7 +767,7 @@ public void drawItemShopMenu(final Screen screen,final int selectedItem) {
backBufferGraphics.drawString(priceText2, priceX2, screen.getHeight() / 2 + 90);

// Draw the third item
int itemX3 = startX + 2 * (itemWidth + spacing);

if (selectedItem == 72) {
backBufferGraphics.setColor(Color.GREEN);
} else {
Expand Down

0 comments on commit f8c88bf

Please sign in to comment.