From 82f90162551f950b06ab497de220b62633b76828 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Thu, 2 Jun 2022 21:24:38 -0500 Subject: [PATCH] Display View and Tile parameters per screen instead of on an individual block. Additionally, create a system where we can load/unload active game objects Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 --- src/sig/RabiClone.java | 19 ++++++++++++++----- src/sig/objects/EditorRenderer.java | 11 +++++++++-- src/sig/objects/LevelRenderer.java | 5 +++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/sig/RabiClone.java b/src/sig/RabiClone.java index 29b292a..f939663 100644 --- a/src/sig/RabiClone.java +++ b/src/sig/RabiClone.java @@ -31,7 +31,7 @@ public class RabiClone{ public static Point MOUSE_POS; public static LevelRenderer level_renderer; - public static Player player,player2; + public static Player player; public static Maps CURRENT_MAP = Maps.WORLD1; public static void main(String[] args) { @@ -54,9 +54,7 @@ public class RabiClone{ f.setVisible(true); OBJ.add(level_renderer = new LevelRenderer(p)); - OBJ.add(player = new Player(p)); - OBJ.add(player2 = new Player(p)); - player2.setX(64); + StartGame(); p.render(); @@ -70,11 +68,13 @@ public class RabiClone{ if (level_renderer instanceof EditorRenderer) { OBJ.remove(level_renderer); OBJ.add(level_renderer=new LevelRenderer(p)); + StartGame(); } } if (p.KEYS.getOrDefault(KeyEvent.VK_F2,false)) { if (!(level_renderer instanceof EditorRenderer)) { - OBJ.remove(level_renderer); + OBJ.clear(); + ResetGame(); OBJ.add(level_renderer=new EditorRenderer(p)); } } @@ -87,6 +87,15 @@ public class RabiClone{ } } } + + private static void ResetGame() { + player=null; + } + + private static void StartGame() { + OBJ.add(player = new Player(p)); + } + private static void ChooseBestRatio() { while (f.getWidth()*(SIZE_MULTIPLIER+1)