From c55bf8d043001f65a41988b0362f14e1fa5f6835 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 29 Nov 2025 23:40:47 +0100 Subject: [PATCH] re-arranged some variables --- src/de/miaurizius/jgame2d/core/GamePanel.java | 8 +++----- src/de/miaurizius/jgame2d/core/UI.java | 2 +- src/de/miaurizius/jgame2d/entity/Entity.java | 19 +++++++++++-------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/de/miaurizius/jgame2d/core/GamePanel.java b/src/de/miaurizius/jgame2d/core/GamePanel.java index e871db7..0e78c8b 100644 --- a/src/de/miaurizius/jgame2d/core/GamePanel.java +++ b/src/de/miaurizius/jgame2d/core/GamePanel.java @@ -17,10 +17,8 @@ public class GamePanel extends JPanel implements Runnable { // SCREEN SETTINGS final int originalTileSize = 16; //16x16 tile final int scale = 3; - - public final int tileSize = originalTileSize * scale; //48x48 tile - // 4:3 ratio public final int maxScreenCol = 16; + public final int tileSize = originalTileSize * scale; //48x48 tile public final int maxScreenRow = 12; public final int screenWidth = tileSize * maxScreenCol; // 768 pixels public final int screenHeight = tileSize * maxScreenRow; // 576 pixels @@ -36,12 +34,12 @@ public class GamePanel extends JPanel implements Runnable { // SYSTEM public TileManager tileM = new TileManager(this); public KeyHandler keyH = new KeyHandler(this); - Sound se = new Sound(); - Sound music = new Sound(); public CollisionHandler collisionH = new CollisionHandler(this); public AssetSetter assetSetter = new AssetSetter(this); public UI ui = new UI(this); public EventHandler eventH = new EventHandler(this); + Sound se = new Sound(); + Sound music = new Sound(); Thread gameThread; // ENTITY AND OBJECT diff --git a/src/de/miaurizius/jgame2d/core/UI.java b/src/de/miaurizius/jgame2d/core/UI.java index f7a8735..7f2f16f 100644 --- a/src/de/miaurizius/jgame2d/core/UI.java +++ b/src/de/miaurizius/jgame2d/core/UI.java @@ -14,7 +14,7 @@ public class UI { Font arial_40, arial_80B; //TODO: Custom font loader: https://www.youtube.com/watch?v=g-wrebFVP3E BufferedImage heart_full, heart_half, heart_blank; public String currentDialogue; - public int commandNum = 0; + public int commandNum; public UI(GamePanel panel) { this.panel = panel; diff --git a/src/de/miaurizius/jgame2d/entity/Entity.java b/src/de/miaurizius/jgame2d/entity/Entity.java index 03dba40..1e5a5c4 100644 --- a/src/de/miaurizius/jgame2d/entity/Entity.java +++ b/src/de/miaurizius/jgame2d/entity/Entity.java @@ -22,22 +22,25 @@ public class Entity { public Rectangle solidArea = new Rectangle(0, 0, 48, 48); public Rectangle attackArea = new Rectangle(0, 0, 0, 0); public int solidAreaDefaultX, solidAreaDefaultY; - public boolean collision = false; + public boolean collision; String[] dialogue = new String[20]; // STATE public int worldX, worldY; public Direction direction = Direction.DOWN; public int spriteNum = 1; - int dialogueIndex = 0; - public boolean collisionOn = false; - public boolean invincible = false; - boolean attacking = false; //TODO: https://youtu.be/HL39xRzPpm4?t=551 + int dialogueIndex; + public boolean collisionOn; + public boolean invincible; + boolean attacking; + boolean alive = true; + boolean dying; // COUNTER - public int spriteCounter = 0; - public int actionLock = 0; - public int invincibleCount = 0; + public int spriteCounter; + public int actionLock; + public int invincibleCount; + int dyingCount; // ATTRIBUTES public EntityType type;