New core landing animation

This commit is contained in:
Anuken
2021-07-26 19:29:14 -04:00
parent aab79a90fb
commit c19a7e8452
23 changed files with 201 additions and 43 deletions

View File

@@ -29,6 +29,10 @@ public class CoreBlock extends StorageBlock{
//hacky way to pass item modules between methods
private static ItemModule nextItems;
public @Load("@-thruster1") TextureRegion thruster1; //top right
public @Load("@-thruster2") TextureRegion thruster2; //bot left
public float thrusterLength = 14f/4f;
public UnitType unitType = UnitTypes.alpha;
public float captureInvicibility = 60f * 15f;
@@ -176,6 +180,35 @@ public class CoreBlock extends StorageBlock{
public boolean noEffect = false;
public Team lastDamage = Team.derelict;
public float iframes = -1f;
public float thrusterTime = 0f;
@Override
public void draw(){
//draw thrusters when just landed
if(thrusterTime > 0){
float frame = thrusterTime;
Draw.alpha(1f);
drawThrusters(frame);
Draw.rect(block.region, x, y);
Draw.alpha(Interp.pow4In.apply(frame));
drawThrusters(frame);
Draw.reset();
drawTeamTop();
}else{
super.draw();
}
}
public void drawThrusters(float frame){
float length = thrusterLength * (frame - 1f) - 1f/4f;
for(int i = 0; i < 4; i++){
var reg = i >= 2 ? thruster2 : thruster1;
float dx = Geometry.d4x[i] * length, dy = Geometry.d4y[i] * length;
Draw.rect(reg, x + dx, y + dy, i * 90);
}
}
@Override
public void damage(@Nullable Team source, float damage){
@@ -234,6 +267,7 @@ public class CoreBlock extends StorageBlock{
@Override
public void updateTile(){
iframes -= Time.delta;
thrusterTime -= Time.delta/90f;
}
@Override