add isSpinner, isCircle etc in GameObject

This commit is contained in:
yugecin 2016-09-27 18:26:53 +02:00
parent e7e33cd406
commit b842a564f7
4 changed files with 56 additions and 3 deletions

View File

@ -36,7 +36,7 @@ import org.newdawn.slick.Graphics;
/** /**
* Data type representing a circle object. * Data type representing a circle object.
*/ */
public class Circle implements GameObject { public class Circle extends GameObject {
/** The diameter of hit circles. */ /** The diameter of hit circles. */
private static float diameter; private static float diameter;
@ -208,4 +208,20 @@ public class Circle implements GameObject {
@Override @Override
public void reset() {} public void reset() {}
@Override
public boolean isCircle() {
return true;
}
@Override
public boolean isSlider() {
return false;
}
@Override
public boolean isSpinner() {
return false;
}
} }

View File

@ -92,4 +92,9 @@ public abstract class GameObject {
* Resets all internal state so that the hit object can be reused. * Resets all internal state so that the hit object can be reused.
*/ */
public abstract void reset(); public abstract void reset();
public abstract boolean isCircle();
public abstract boolean isSlider();
public abstract boolean isSpinner();
} }

View File

@ -40,7 +40,7 @@ import org.newdawn.slick.Image;
/** /**
* Data type representing a slider object. * Data type representing a slider object.
*/ */
public class Slider implements GameObject { public class Slider extends GameObject {
/** Slider ball frames. */ /** Slider ball frames. */
private static Image[] sliderBallImages; private static Image[] sliderBallImages;
@ -582,4 +582,20 @@ public class Slider implements GameObject {
ticksHit = 0; ticksHit = 0;
tickIntervals = 1; tickIntervals = 1;
} }
@Override
public boolean isCircle() {
return false;
}
@Override
public boolean isSlider() {
return true;
}
@Override
public boolean isSpinner() {
return false;
}
} }

View File

@ -39,7 +39,7 @@ import org.newdawn.slick.Image;
/** /**
* Data type representing a spinner object. * Data type representing a spinner object.
*/ */
public class Spinner implements GameObject { public class Spinner extends GameObject {
/** Container dimensions. */ /** Container dimensions. */
private static int width, height; private static int width, height;
@ -409,4 +409,20 @@ public class Spinner implements GameObject {
deltaOverflow = 0; deltaOverflow = 0;
isSpinning = false; isSpinning = false;
} }
@Override
public boolean isCircle() {
return false;
}
@Override
public boolean isSlider() {
return false;
}
@Override
public boolean isSpinner() {
return true;
}
} }