Skip to content

Commit

Permalink
Fixed Another Merge Issues (resources getters)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomarrelli committed Feb 18, 2024
1 parent 5ce682e commit 2164a1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Binary file modified pvz-clone.jar
Binary file not shown.
17 changes: 9 additions & 8 deletions src/main/java/pvzclone/view/impl/GamePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,15 @@ private void updateEntities(final Graphics2D g) {
* @return image of the entity.
*/
private ImageIcon getEntityImage(final Entities entity) {
return new ImageIcon(
switch (entity.getEntityName()) {
case "Plant" -> PLANT_IMAGE;
case "Zombie" -> ZOMBIE_IMAGE;
case "Bullet" -> BULLET_IMAGE;
case "Sun" -> SUN_IMAGE;
default -> throw new IllegalArgumentException("Unexpected value: " + entity.getClass().getName());
});
final String resource = switch (entity.getEntityName()) {
case "Plant" -> PLANT_IMAGE;
case "Zombie" -> ZOMBIE_IMAGE;
case "Bullet" -> BULLET_IMAGE;
case "Sun" -> SUN_IMAGE;
default -> throw new IllegalArgumentException("Unexpected value: " + entity.getClass().getName());
};

return new ImageIcon(ClassLoader.getSystemResource(resource));
}

/**
Expand Down

0 comments on commit 2164a1d

Please sign in to comment.