Unhardcode frag offsets (#9543)
This commit is contained in:
@@ -174,6 +174,8 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f;
|
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f;
|
||||||
/** Random range of frag lifetime as a multiplier. */
|
/** Random range of frag lifetime as a multiplier. */
|
||||||
public float fragLifeMin = 1f, fragLifeMax = 1f;
|
public float fragLifeMin = 1f, fragLifeMax = 1f;
|
||||||
|
/** Random offset of frag bullets from the parent bullet. */
|
||||||
|
public float fragOffsetMin = 1f, fragOffsetMax = 7f;
|
||||||
|
|
||||||
/** Bullet that is created at a fixed interval. */
|
/** Bullet that is created at a fixed interval. */
|
||||||
public @Nullable BulletType intervalBullet;
|
public @Nullable BulletType intervalBullet;
|
||||||
@@ -509,7 +511,7 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
public void createFrags(Bullet b, float x, float y){
|
public void createFrags(Bullet b, float x, float y){
|
||||||
if(fragBullet != null && (fragOnAbsorb || !b.absorbed)){
|
if(fragBullet != null && (fragOnAbsorb || !b.absorbed)){
|
||||||
for(int i = 0; i < fragBullets; i++){
|
for(int i = 0; i < fragBullets; i++){
|
||||||
float len = Mathf.random(1f, 7f);
|
float len = Mathf.random(fragOffsetMin, fragOffsetMax);
|
||||||
float a = b.rotation() + Mathf.range(fragRandomSpread / 2) + fragAngle + ((i - fragBullets/2) * fragSpread);
|
float a = b.rotation() + Mathf.range(fragRandomSpread / 2) + fragAngle + ((i - fragBullets/2) * fragSpread);
|
||||||
fragBullet.create(b, x + Angles.trnsx(a, len), y + Angles.trnsy(a, len), a, Mathf.random(fragVelocityMin, fragVelocityMax), Mathf.random(fragLifeMin, fragLifeMax));
|
fragBullet.create(b, x + Angles.trnsx(a, len), y + Angles.trnsy(a, len), a, Mathf.random(fragVelocityMin, fragVelocityMax), Mathf.random(fragLifeMin, fragLifeMax));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user