From eae91e38085bfbfccccb07af7af7f5f72685658b Mon Sep 17 00:00:00 2001 From: yugecin Date: Sat, 1 Oct 2016 10:50:35 +0200 Subject: [PATCH] beamspinner --- src/yugecin/opsudance/Dancer.java | 4 +- .../opsudance/spinners/BeamSpinner.java | 87 +++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 src/yugecin/opsudance/spinners/BeamSpinner.java diff --git a/src/yugecin/opsudance/Dancer.java b/src/yugecin/opsudance/Dancer.java index 95d41bb4..e722d820 100644 --- a/src/yugecin/opsudance/Dancer.java +++ b/src/yugecin/opsudance/Dancer.java @@ -25,6 +25,7 @@ import itdelatrisu.opsu.objects.Slider; import itdelatrisu.opsu.objects.curves.Vec2f; import yugecin.opsudance.movers.Mover; import yugecin.opsudance.movers.factories.*; +import yugecin.opsudance.spinners.BeamSpinner; import yugecin.opsudance.spinners.RektSpinner; import yugecin.opsudance.spinners.Spinner; @@ -43,7 +44,8 @@ public class Dancer { }; public static Spinner[] spinners = new Spinner[] { - new RektSpinner() + new RektSpinner(), + new BeamSpinner(), }; public static Dancer instance = new Dancer(); diff --git a/src/yugecin/opsudance/spinners/BeamSpinner.java b/src/yugecin/opsudance/spinners/BeamSpinner.java new file mode 100644 index 00000000..c221ff55 --- /dev/null +++ b/src/yugecin/opsudance/spinners/BeamSpinner.java @@ -0,0 +1,87 @@ +/* + * opsu!dance - fork of opsu! with cursordance auto + * Copyright (C) 2016 yugecin + * + * opsu!dance is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * opsu!dance is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with opsu!dance. If not, see . + */ +package yugecin.opsudance.spinners; + +import itdelatrisu.opsu.Options; + +public class BeamSpinner extends Spinner { + + private double ang = 0; + private double[] point; + private int index; + private int delay = 0; + + @Override + public void init() + { + ang = 0; + index = 0; + point = new double[2]; + } + + @Override + public double[] getPoint() + { + if( ++delay > DELAY ) + { + delay = 0; + index = ++index % 4; + } + + final int MOD = 60; + + point[0] = Options.width / 2d; + point[1] = Options.height / 2d; + + if( index == 0 ) + { + add( MOD, 90 ); + add( MOD, 180 ); + } + else if( index == 1 ) + { + add( MOD, 90 ); + add( Options.height / 2 * 0.8d, 0 ); + } + else if( index == 2 ) + { + add( MOD, -90 ); + add( Options.height / 2 * 0.8d, 0 ); + } + else if( index == 3 ) + { + add( MOD, -90 ); + add( MOD, 180 ); + ang += 0.3; + } + + return point; + } + + private void add( double rad, double ang ) + { + point[0] += rad * Math.cos( (this.ang + ang) / 180d * Math.PI); + point[1] -= rad * Math.sin( (this.ang + ang) / 180d * Math.PI); + } + + @Override + public String toString() { + return "Beam"; + } + +}