diff options
Diffstat (limited to 'PunchingBag/src/PunchingBag.java')
-rw-r--r-- | PunchingBag/src/PunchingBag.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/PunchingBag/src/PunchingBag.java b/PunchingBag/src/PunchingBag.java index 925d5c6..a7b7070 100644 --- a/PunchingBag/src/PunchingBag.java +++ b/PunchingBag/src/PunchingBag.java @@ -2,6 +2,8 @@ import gnu.io.CommPortIdentifier; import javax.swing.event.EventListenerList; + + import java.awt.Rectangle; import java.awt.geom.Area; @@ -98,6 +100,10 @@ public class PunchingBag implements Runnable { void circleExpand(int x, int y, int intensity) { runningEffects.add(new CircleExpand(x, y, 100)); } + + void squareExpand(int x, int y, int intensity, Colour colour) { + runningEffects.add(new SquareExpand(x, y, intensity, colour)); + } void noise(Rectangle rect, long time) { runningEffects.add(new Noise(rect, System.currentTimeMillis() + time)); @@ -190,6 +196,35 @@ public class PunchingBag implements Runnable { } } + + class SquareExpand extends Effect { + final int x; + final int y; + final Colour colour; + int intensity; + boolean drawnSomething = true; + + int heightWidth = 2; + + + public SquareExpand(int x, int y, int intensity, Colour colour) { + this.x = x; + this.y = y; + this.intensity = intensity; + this.colour = colour; + + } + + + public void draw() { + heightWidth += 0.1 + 0.1 + (heightWidth / 20); + if (!drawRectCenter(x, y, heightWidth, heightWidth, colour)) + stop = true; + + + } + + } class Noise extends Effect { final Rectangle area; |