Turret pattern rewrite
This commit is contained in:
18
core/src/mindustry/entities/pattern/ShootAlternate.java
Normal file
18
core/src/mindustry/entities/pattern/ShootAlternate.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
public class ShootAlternate extends ShootPattern{
|
||||
/** number of barrels used for shooting. */
|
||||
public int barrels = 2;
|
||||
/** spread between barrels, in world units - not degrees. */
|
||||
public float spread = 5f;
|
||||
/** offset of barrel to start on */
|
||||
public int barrelOffset = 0;
|
||||
|
||||
@Override
|
||||
public void shoot(int totalShots, BulletHandler handler){
|
||||
for(int i = 0; i < shots; i++){
|
||||
float index = ((totalShots + i + barrelOffset) % barrels) - (barrels-1)/2f;
|
||||
handler.shoot(index * spread, 0, 0f, firstShotDelay + shotDelay * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user