Unit shadows

This commit is contained in:
Anuken
2019-03-28 12:42:04 -04:00
parent c8a15bb7e4
commit d56869aefa
10 changed files with 4428 additions and 4390 deletions

View File

@@ -184,6 +184,8 @@ public class Renderer implements ApplicationListener{
blocks.drawBlocks(Layer.overlay);
drawGroundShadows();
drawAllTeams(false);
blocks.skipLayer(Layer.turret);
@@ -224,6 +226,28 @@ public class Renderer implements ApplicationListener{
Draw.flush();
}
private void drawGroundShadows(){
Draw.color(0, 0, 0, 0.4f);
float rad = 1.6f;
Consumer<Unit> draw = u -> {
float size = Math.max(u.getIconRegion().getWidth(), u.getIconRegion().getHeight()) * Draw.scl;
Draw.rect("circle-shadow", u.x, u.y, size * rad, size * rad);
};
for(EntityGroup<? extends BaseUnit> group : unitGroups){
if(!group.isEmpty()){
drawAndInterpolate(group, unit -> !unit.isDead(), draw::accept);
}
}
if(!playerGroup.isEmpty()){
drawAndInterpolate(playerGroup, unit -> !unit.isDead(), draw::accept);
}
Draw.color();
}
private void drawFlyerShadows(){
float trnsX = -12, trnsY = -13;
Draw.color(0, 0, 0, 0.22f);

View File

@@ -278,7 +278,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
if(dead) return;
if(!movement.isZero() && moved && !state.isPaused()){
walktime += movement.len() / 1f * getFloorOn().speedMultiplier;
walktime += movement.len() * getFloorOn().speedMultiplier * 2f;
baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f);
}