diff options
Diffstat (limited to 'PunchingBag')
-rw-r--r-- | PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java index a7d7f0c..7f0fe06 100644 --- a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java +++ b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java @@ -334,6 +334,14 @@ public class PunchingBag implements Runnable { public void noise(Rectangle rect, long time) { runningEffects.add(new Noise(rect, System.currentTimeMillis() + time)); } + + /** + * @param rect + * @param time + */ + public void noise(Rectangle rect) { + runningEffects.add(new Noise(rect)); + } /** * This represents an effect (a persistent visual artifact). The effects @@ -527,10 +535,14 @@ public class PunchingBag implements Runnable { this.area = area; this.endTime = endTime; } + + public Noise(Rectangle area) { + this(area, (long) 0); + } @Override public void draw() { - if (endTime >= System.currentTimeMillis()) { + if (endTime >= System.currentTimeMillis() && endTime != 0) { for (int y = area.y; y < (area.y + area.height); y++) { for (int x = area.x; x < (area.x + area.width); x++) { double random = Math.random(); |