diff options
Diffstat (limited to '')
-rw-r--r-- | src/subconscious/graphics/MapScene.java | 14 | ||||
-rw-r--r-- | src/subconscious/graphics/Sprite.java | 8 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/subconscious/graphics/MapScene.java b/src/subconscious/graphics/MapScene.java index c7f4167..c597d98 100644 --- a/src/subconscious/graphics/MapScene.java +++ b/src/subconscious/graphics/MapScene.java @@ -166,12 +166,14 @@ public abstract class MapScene extends Scene { private void renderSprites(Graphics2D g) { for (Sprite sprite : this.sprites) { - Rectangle rect = sprite.getRect(); - Graphics2D spriteGraphics = (Graphics2D) g.create( - rect.x, rect.y, rect.width, rect.height - ); - - sprite.render(spriteGraphics); + if (sprite.isActive()) { + Rectangle rect = sprite.getRect(); + Graphics2D spriteGraphics = (Graphics2D) g.create( + rect.x, rect.y, rect.width, rect.height + ); + + sprite.render(spriteGraphics); + } } // Draw actors diff --git a/src/subconscious/graphics/Sprite.java b/src/subconscious/graphics/Sprite.java index 7c0b9eb..b9e70d9 100644 --- a/src/subconscious/graphics/Sprite.java +++ b/src/subconscious/graphics/Sprite.java @@ -14,7 +14,7 @@ public class Sprite { protected int width, height; protected int dx, dy; - protected boolean loaded = true; + protected boolean active = true; public Sprite(Actor actor) { this.actor = actor; @@ -48,7 +48,7 @@ public class Sprite { return new Rectangle(x, y, width, height); } - public void load() { this.loaded = true; } - public void unload() { this.loaded = false; } - public boolean isLoaded() { return this.loaded; } + public void activate() { this.active = true; } + public void deactivate() { this.active = false; } + public boolean isActive() { return this.active; } } |