Added flyer shadows / Fixed block inventory rebuild spawn / Distributor

This commit is contained in:
Anuken
2018-07-09 20:18:50 -04:00
parent dbee30a412
commit d31fbf3b6f
9 changed files with 56 additions and 9 deletions

View File

@@ -274,6 +274,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
return isLocal ? Float.MAX_VALUE : 40;
}
@Override
public void drawShadow(){
Draw.rect(mech.iconRegion, x + elevation*elevationScale, y - elevation*elevationScale, rotation - 90);
}
@Override
public void draw(){
if((debug && (!showPlayer || !showUI)) || dead) return;

View File

@@ -38,6 +38,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
public static final float velocityPercision = 8f;
/**Maximum absolute value of a velocity vector component.*/
public static final float maxAbsVelocity = 127f/velocityPercision;
public static final float elevationScale = 4f;
private static final Vector2 moveVector = new Vector2();
@@ -52,6 +53,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
protected Vector2 velocity = new Translator(0f, 0.0001f);
protected float hitTime;
protected float drownTime;
protected float elevation;
@Override
public UnitInventory getInventory() {
@@ -225,6 +227,8 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
if(isFlying()) {
x += velocity.x / getMass() * Timers.delta();
y += velocity.y / getMass() * Timers.delta();
elevation = Mathf.lerpDelta(elevation, tile.elevation, 0.04f);
}else{
boolean onLiquid = floor.isLiquid;
@@ -299,6 +303,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
public void drawUnder(){}
public void drawOver(){}
public void drawShadow(){}
public void drawView(){
Fill.circle(x, y, getViewDistance());

View File

@@ -32,6 +32,11 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
}
@Override
public void drawShadow(){
Draw.rect(type.region, x + elevation*elevationScale, y - elevation*elevationScale, rotation - 90);
}
@Override
public CarriableTrait getCarry() {
return carrying;