summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-12-13 00:37:08 +0100
committerNao Pross <naopross@thearcway.org>2018-12-13 00:37:08 +0100
commitc79eccf09042be0ccc7b579dbe033ca3739d45f4 (patch)
tree229d76183c2f05046b1d5e82c54673d93b3d1ff8
parentFix Map.getSize() to return a Dimension (diff)
downloadSubconscious-java-c79eccf09042be0ccc7b579dbe033ca3739d45f4.tar.gz
Subconscious-java-c79eccf09042be0ccc7b579dbe033ca3739d45f4.zip
Change Tile.loaded to Tile.active
Diffstat (limited to '')
-rw-r--r--src/subconscious/graphics/MapScene.java14
-rw-r--r--src/subconscious/graphics/Sprite.java8
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; }
}