Misc turret progress

This commit is contained in:
Anuken
2022-02-11 15:24:34 -05:00
parent ba3e2f6f67
commit 7c507ce2f4
7 changed files with 34 additions and 24 deletions

View File

@@ -14,8 +14,9 @@ public class BasicBulletType extends BulletType{
public Color mixColorFrom = new Color(1f, 1f, 1f, 0f), mixColorTo = new Color(1f, 1f, 1f, 0f);
public float width = 5f, height = 7f;
public float shrinkX = 0f, shrinkY = 0.5f;
public float spin = 0;
public float spin = 0, rotationOffset = 0f;
public String sprite;
public @Nullable String backSprite;
public TextureRegion backRegion;
public TextureRegion frontRegion;
@@ -36,7 +37,7 @@ public class BasicBulletType extends BulletType{
@Override
public void load(){
backRegion = Core.atlas.find(sprite + "-back");
backRegion = Core.atlas.find(backSprite == null ? (sprite + "-back") : backSprite);
frontRegion = Core.atlas.find(sprite);
}
@@ -45,14 +46,17 @@ public class BasicBulletType extends BulletType{
super.draw(b);
float height = this.height * ((1f - shrinkY) + shrinkY * 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);
float offset = -90 + (spin != 0 ? Mathf.randomSeed(b.id, 360f) + b.time * spin : 0f) + rotationOffset;
Color mix = Tmp.c1.set(mixColorFrom).lerp(mixColorTo, b.fin());
Draw.mixcol(mix, mix.a);
Draw.color(backColor);
Draw.rect(backRegion, b.x, b.y, width, height, b.rotation() + offset);
if(backRegion.found()){
Draw.color(backColor);
Draw.rect(backRegion, b.x, b.y, width, height, b.rotation() + offset);
}
Draw.color(frontColor);
Draw.rect(frontRegion, b.x, b.y, width, height, b.rotation() + offset);