Refactored fireball into FireBulletType
This commit is contained in:
@@ -343,15 +343,6 @@ public class BulletType extends Content implements Cloneable{
|
||||
if(instantDisappear){
|
||||
b.time = lifetime;
|
||||
}
|
||||
|
||||
if(fragBullet != null || splashDamageRadius > 0 || lightning > 0){
|
||||
despawnHit = true;
|
||||
}
|
||||
|
||||
if(lightRadius == -1){
|
||||
lightRadius = Math.max(18, hitSize * 5f);
|
||||
}
|
||||
drawSize = Math.max(drawSize, trailLength * speed * 2f);
|
||||
}
|
||||
|
||||
public void update(Bullet b){
|
||||
@@ -412,6 +403,15 @@ public class BulletType extends Content implements Cloneable{
|
||||
if(lightningType == null){
|
||||
lightningType = !collidesAir ? Bullets.damageLightningGround : Bullets.damageLightning;
|
||||
}
|
||||
|
||||
if(fragBullet != null || splashDamageRadius > 0 || lightning > 0){
|
||||
despawnHit = true;
|
||||
}
|
||||
|
||||
if(lightRadius == -1){
|
||||
lightRadius = Math.max(18, hitSize * 5f);
|
||||
}
|
||||
drawSize = Math.max(drawSize, trailLength * speed * 2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
64
core/src/mindustry/entities/bullet/FireBulletType.java
Normal file
64
core/src/mindustry/entities/bullet/FireBulletType.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package mindustry.entities.bullet;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
public class FireBulletType extends BulletType{
|
||||
public Color colorFrom = Pal.lightFlame, colorMid = Pal.darkFlame, colorTo = Color.gray;
|
||||
public float radius = 3f;
|
||||
public float velMin = 0.6f, velMax = 2.6f;
|
||||
public float fireTrailChance = 0.04f;
|
||||
public Effect trailEffect2 = Fx.ballfire;
|
||||
public float fireEffectChance = 0.1f, fireEffectChance2 = 0.1f;
|
||||
|
||||
{
|
||||
pierce = true;
|
||||
collidesTiles = false;
|
||||
collides = false;
|
||||
drag = 0.03f;
|
||||
hitEffect = despawnEffect = Fx.none;
|
||||
trailEffect = Fx.fireballsmoke;
|
||||
}
|
||||
|
||||
public FireBulletType(float speed, float damage){
|
||||
super(speed, damage);
|
||||
}
|
||||
|
||||
public FireBulletType(){}
|
||||
|
||||
@Override
|
||||
public void init(Bullet b){
|
||||
super.init(b);
|
||||
|
||||
b.vel.setLength(Mathf.random(velMin, velMax));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b){
|
||||
Draw.color(colorFrom, colorMid, colorTo, b.fin());
|
||||
Fill.circle(b.x, b.y, radius * b.fout());
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Bullet b){
|
||||
super.update(b);
|
||||
|
||||
if(Mathf.chanceDelta(fireTrailChance)){
|
||||
Fires.create(b.tileOn());
|
||||
}
|
||||
|
||||
if(Mathf.chanceDelta(fireEffectChance)){
|
||||
trailEffect.at(b.x, b.y);
|
||||
}
|
||||
|
||||
if(Mathf.chanceDelta(fireEffectChance2)){
|
||||
trailEffect2.at(b.x, b.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import static mindustry.Vars.*;
|
||||
public class MassDriverBolt extends BulletType{
|
||||
|
||||
public MassDriverBolt(){
|
||||
super(1f, 50);
|
||||
super(1f, 75);
|
||||
collidesTiles = false;
|
||||
lifetime = 1f;
|
||||
despawnEffect = Fx.smeltsmoke;
|
||||
|
||||
Reference in New Issue
Block a user