Interval bullets for continuous bullets (#8628)

This commit is contained in:
MEEPofFaith 2023-05-19 18:02:54 -07:00 committed by GitHub
parent 7c52444e3c
commit b6d27c16be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -74,6 +74,8 @@ public class ContinuousBulletType extends BulletType{
if(shake > 0){
Effect.shake(shake, shake, b);
}
updateBulletInterval(b);
}
public void applyDamage(Bullet b){

View file

@ -75,7 +75,9 @@ public class PointLaserBulletType extends BulletType{
@Override
public void update(Bullet b){
super.update(b);
updateTrail(b);
updateTrailEffects(b);
updateBulletInterval(b);
if(b.timer.get(0, damageInterval)){
Damage.collidePoint(b, b.team, hitEffect, b.aimX, b.aimY);
@ -115,4 +117,13 @@ public class PointLaserBulletType extends BulletType{
b.trail.update(b.aimX, b.aimY, b.fslope() * (1f - (trailSinMag > 0 ? Mathf.absin(Time.time, trailSinScl, trailSinMag) : 0f)));
}
}
public void updateBulletInterval(Bullet b){
if(intervalBullet != null && b.time >= intervalDelay && b.timer.get(2, bulletInterval)){
float ang = b.rotation();
for(int i = 0; i < intervalBullets; i++){
intervalBullet.create(b, b.aimX, b.aimY, ang + Mathf.range(intervalRandomSpread) + intervalAngle + ((i - (intervalBullets - 1f)/2f) * intervalSpread));
}
}
}
}