Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -8,13 +8,14 @@ import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class TreeBlock extends Block{
|
||||
public @Load("@-shadow") TextureRegion shadow;
|
||||
public float shadowOffset = -4f;
|
||||
public @Load("@-shadow") TextureRegion shadow;
|
||||
|
||||
public TreeBlock(String name){
|
||||
super(name);
|
||||
solid = true;
|
||||
clipSize = 90;
|
||||
customShadow = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -26,15 +27,22 @@ public class TreeBlock extends Block{
|
||||
w = region.width * region.scl(), h = region.height * region.scl(),
|
||||
scl = 30f, mag = 0.2f;
|
||||
|
||||
if(shadow.found()){
|
||||
TextureRegion shad = variants == 0 ? customShadowRegion : variantShadowRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantShadowRegions.length - 1))];
|
||||
|
||||
if(shad.found()){
|
||||
Draw.z(Layer.power - 1);
|
||||
Draw.rect(shadow, tile.worldx() + shadowOffset, tile.worldy() + shadowOffset, rot);
|
||||
Draw.rect(shad, tile.worldx() + shadowOffset, tile.worldy() + shadowOffset, rot);
|
||||
}
|
||||
|
||||
TextureRegion reg = variants == 0 ? region : variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))];
|
||||
|
||||
Draw.z(Layer.power + 1);
|
||||
Draw.rectv(region, x, y, w, h, rot, vec -> vec.add(
|
||||
Draw.rectv(reg, x, y, w, h, rot, vec -> vec.add(
|
||||
Mathf.sin(vec.y*3 + Time.time, scl, mag) + Mathf.sin(vec.x*3 - Time.time, 70, 0.8f),
|
||||
Mathf.cos(vec.x*3 + Time.time + 8, scl + 6f, mag * 1.1f) + Mathf.sin(vec.y*3 - Time.time, 50, 0.2f)
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawShadow(Tile tile){}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user