aboutsummaryrefslogtreecommitdiff
path: root/PunchingBag
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2011-09-16 11:42:03 +0100
committerChristopher Baines <cbaines8@gmail.com>2011-09-16 11:42:03 +0100
commit4fa115f2270fde1acfb9da36e8b47166190f03da (patch)
tree0d233248a795bfde023ac09b527f290355d8fba5 /PunchingBag
parente1971aa2814af050b25b970197e95caae0b8fb72 (diff)
downloadpunchingbag-4fa115f2270fde1acfb9da36e8b47166190f03da.tar
punchingbag-4fa115f2270fde1acfb9da36e8b47166190f03da.tar.gz
Allow Noise to go on forever.
Diffstat (limited to 'PunchingBag')
-rw-r--r--PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java14
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();