From b842a564f763891f5a5a9f6ea77fe7846bc523a8 Mon Sep 17 00:00:00 2001 From: yugecin Date: Tue, 27 Sep 2016 18:26:53 +0200 Subject: [PATCH] add isSpinner, isCircle etc in GameObject --- src/itdelatrisu/opsu/objects/Circle.java | 18 +++++++++++++++++- src/itdelatrisu/opsu/objects/GameObject.java | 5 +++++ src/itdelatrisu/opsu/objects/Slider.java | 18 +++++++++++++++++- src/itdelatrisu/opsu/objects/Spinner.java | 18 +++++++++++++++++- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index 15e94524..f9b99123 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -36,7 +36,7 @@ import org.newdawn.slick.Graphics; /** * Data type representing a circle object. */ -public class Circle implements GameObject { +public class Circle extends GameObject { /** The diameter of hit circles. */ private static float diameter; @@ -208,4 +208,20 @@ public class Circle implements GameObject { @Override public void reset() {} + + @Override + public boolean isCircle() { + return true; + } + + @Override + public boolean isSlider() { + return false; + } + + @Override + public boolean isSpinner() { + return false; + } + } diff --git a/src/itdelatrisu/opsu/objects/GameObject.java b/src/itdelatrisu/opsu/objects/GameObject.java index 137eceec..a4f8ac78 100644 --- a/src/itdelatrisu/opsu/objects/GameObject.java +++ b/src/itdelatrisu/opsu/objects/GameObject.java @@ -92,4 +92,9 @@ public abstract class GameObject { * Resets all internal state so that the hit object can be reused. */ public abstract void reset(); + + public abstract boolean isCircle(); + public abstract boolean isSlider(); + public abstract boolean isSpinner(); + } diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 888bdaec..4dae2fbd 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -40,7 +40,7 @@ import org.newdawn.slick.Image; /** * Data type representing a slider object. */ -public class Slider implements GameObject { +public class Slider extends GameObject { /** Slider ball frames. */ private static Image[] sliderBallImages; @@ -582,4 +582,20 @@ public class Slider implements GameObject { ticksHit = 0; tickIntervals = 1; } + + @Override + public boolean isCircle() { + return false; + } + + @Override + public boolean isSlider() { + return true; + } + + @Override + public boolean isSpinner() { + return false; + } + } diff --git a/src/itdelatrisu/opsu/objects/Spinner.java b/src/itdelatrisu/opsu/objects/Spinner.java index e82fa6a3..48f0803f 100644 --- a/src/itdelatrisu/opsu/objects/Spinner.java +++ b/src/itdelatrisu/opsu/objects/Spinner.java @@ -39,7 +39,7 @@ import org.newdawn.slick.Image; /** * Data type representing a spinner object. */ -public class Spinner implements GameObject { +public class Spinner extends GameObject { /** Container dimensions. */ private static int width, height; @@ -409,4 +409,20 @@ public class Spinner implements GameObject { deltaOverflow = 0; isSpinning = false; } + + @Override + public boolean isCircle() { + return false; + } + + @Override + public boolean isSlider() { + return false; + } + + @Override + public boolean isSpinner() { + return true; + } + }