Helix shoot pattern / Min mod game version
This commit is contained in:
17
core/src/mindustry/entities/pattern/ShootHelix.java
Normal file
17
core/src/mindustry/entities/pattern/ShootHelix.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
import arc.math.*;
|
||||
|
||||
public class ShootHelix extends ShootPattern{
|
||||
//TODO: pattern is broken without a proper offset
|
||||
public float scl = 2f, mag = 0.5f, offset = Mathf.PI * 1.25f;
|
||||
|
||||
@Override
|
||||
public void shoot(int totalShots, BulletHandler handler){
|
||||
for(int i = 0; i < shots; i++){
|
||||
for(int sign : Mathf.signs){
|
||||
handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i, b -> Mathf.sin(b.time + offset, scl, mag * sign));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,10 @@ public class ShootMulti extends ShootPattern{
|
||||
|
||||
@Override
|
||||
public void shoot(int totalShots, BulletHandler handler){
|
||||
source.shoot(totalShots, (x, y, rotation, delay) -> {
|
||||
source.shoot(totalShots, (x, y, rotation, delay, move) -> {
|
||||
for(var pattern : dest){
|
||||
pattern.shoot(totalShots, (x2, y2, rot2, delay2) -> {
|
||||
handler.shoot(x + x2, y + y2, rotation + rot2, delay + delay2);
|
||||
pattern.shoot(totalShots, (x2, y2, rot2, delay2, mover) -> {
|
||||
handler.shoot(x + x2, y + y2, rotation + rot2, delay + delay2, mover);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
import mindustry.entities.*;
|
||||
|
||||
/** Handles different types of bullet patterns for shooting. */
|
||||
public class ShootPattern{
|
||||
/** amount of shots per "trigger pull" */
|
||||
@@ -23,6 +25,10 @@ public class ShootPattern{
|
||||
* @param rotation rotation offset relative to weapon
|
||||
* @param delay bullet delay in ticks
|
||||
* */
|
||||
void shoot(float x, float y, float rotation, float delay);
|
||||
default void shoot(float x, float y, float rotation, float delay){
|
||||
shoot(x, y, rotation, delay, null);
|
||||
}
|
||||
|
||||
void shoot(float x, float y, float rotation, float delay, Mover move);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user