diff options
| author | mithe24 <mithe24@student.sdu.dk> | 2025-05-07 17:11:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-07 17:11:58 +0200 |
| commit | c164daed53574babb26796b05682432709e2c5c1 (patch) | |
| tree | 50690b34f82847368be7c08c54b4489d4fea3e15 /pacman/view/src/main/java/com | |
| parent | ec0f4221ecd71c0b18e8403daa58b66077ec4343 (diff) | |
| download | pacman-c164daed53574babb26796b05682432709e2c5c1.tar.gz pacman-c164daed53574babb26796b05682432709e2c5c1.zip | |
Feature/json parser (#18)
* chore(model/json-parser): Added maven dependency
* chore(model): Removed old test JSON file
* refactor(model/GameState): List better then map, entities should be able
to overlap
* feat(Pacman): Added GameState builder to initiate GameState with given
paramters.
Added a short example JSON-file, more key-value pairs needs to be added
as the game progresses.
Likewise the builder won't parse for any other key-value pair
automatically.
Diffstat (limited to '')
| -rw-r--r-- | pacman/view/src/main/java/com/gr15/pacman/view/GameView.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pacman/view/src/main/java/com/gr15/pacman/view/GameView.java b/pacman/view/src/main/java/com/gr15/pacman/view/GameView.java index 62617d6..d56a1e1 100644 --- a/pacman/view/src/main/java/com/gr15/pacman/view/GameView.java +++ b/pacman/view/src/main/java/com/gr15/pacman/view/GameView.java @@ -1,6 +1,7 @@ package com.gr15.pacman.view; import java.util.HashMap; +import java.util.List; import java.util.Map; import com.gr15.pacman.model.GameState; @@ -83,7 +84,8 @@ public class GameView - 0.5) * 16 * scaleY); pacmanSprite.render(gc); - gameState.getEntities().forEach((pos, entity) -> { + List<Entity> entities = gameState.getEntities(); + for (Entity entity : entities) { Image texture = entityTextures.get(entity); if (texture != null) { gc.drawImage(texture, @@ -92,7 +94,7 @@ public class GameView texture.getWidth() * scaleX, texture.getHeight() * scaleY); } - }); + } gameState.getItems().forEach((pos, item) -> { Image texture = itemTextures.get(item); |