From 987e7b82e0974de1f943689f40d3b3c9635417e2 Mon Sep 17 00:00:00 2001 From: Victor Date: Wed, 26 Feb 2014 18:09:12 +0200 Subject: [PATCH] Add isVisible method --- .../src/com/annimon/militaryhero/Enemy.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Military-Hero-Core/src/com/annimon/militaryhero/Enemy.java b/Military-Hero-Core/src/com/annimon/militaryhero/Enemy.java index 52664f3..5178c84 100644 --- a/Military-Hero-Core/src/com/annimon/militaryhero/Enemy.java +++ b/Military-Hero-Core/src/com/annimon/militaryhero/Enemy.java @@ -13,24 +13,28 @@ public class Enemy { private static final int enemyHeight = enemy.getHeight(); private final int x, y; - private boolean isVisible; + private boolean visible; public Enemy(int x, int y) { this.x = x; this.y = y; - isVisible = true; + visible = true; + } + + public boolean isVisible() { + return visible; } public boolean isCollide(int sx, int sy) { if (inRange(sx, x, x + enemyWidth) && inRange(sy, y, y + enemyHeight)) { - isVisible = false; + visible = false; return true; } return false; } public void draw(Graphics g) { - if (isVisible) { + if (visible) { g.drawImage(enemy, x, y); } }