This commit is contained in:
Anuken
2020-07-14 15:27:58 -04:00
parent e0f1242ca7
commit 7f6026bd52

View File

@@ -4,6 +4,7 @@ import arc.Core;
import arc.graphics.Color; import arc.graphics.Color;
import arc.graphics.g2d.Draw; import arc.graphics.g2d.Draw;
import arc.graphics.g2d.TextureRegion; import arc.graphics.g2d.TextureRegion;
import arc.math.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.Pal; import mindustry.graphics.Pal;
@@ -12,6 +13,7 @@ public class BasicBulletType extends BulletType{
public Color backColor = Pal.bulletYellowBack, frontColor = Pal.bulletYellow; public Color backColor = Pal.bulletYellowBack, frontColor = Pal.bulletYellow;
public float width = 5f, height = 7f; public float width = 5f, height = 7f;
public float shrinkX = 0f, shrinkY = 0.5f; public float shrinkX = 0f, shrinkY = 0.5f;
public float spin = 0;
public String sprite; public String sprite;
public TextureRegion backRegion; public TextureRegion backRegion;
@@ -42,11 +44,12 @@ public class BasicBulletType extends BulletType{
public void draw(Bullet b){ public void draw(Bullet b){
float height = this.height * ((1f - shrinkY) + shrinkY * b.fout()); float height = this.height * ((1f - shrinkY) + shrinkY * b.fout());
float width = this.width * ((1f - shrinkX) + shrinkX * b.fout()); float width = this.width * ((1f - shrinkX) + shrinkX * b.fout());
float offset = -90 + (spin != 0 ? Mathf.randomSeed(b.id, 360f) + b.time * spin : 0f);
Draw.color(backColor); Draw.color(backColor);
Draw.rect(backRegion, b.x, b.y, width, height, b.rotation() - 90); Draw.rect(backRegion, b.x, b.y, width, height, b.rotation() + offset);
Draw.color(frontColor); Draw.color(frontColor);
Draw.rect(frontRegion, b.x, b.y, width, height, b.rotation() - 90); Draw.rect(frontRegion, b.x, b.y, width, height, b.rotation() + offset);
Draw.color(); Draw.color();
} }
} }