Editor variant regions for wall blocks

This commit is contained in:
Anuken
2021-06-10 15:52:33 -04:00
parent af2830602d
commit 8d9d6385f9
5 changed files with 20 additions and 18 deletions
+7
View File
@@ -863,6 +863,13 @@ public class Block extends UnlockableContent{
mapColor.set(image.get(image.width/2, image.height/2));
}
if(variants > 0){
for(int i = 0; i < variants; i++){
String rname = name + (i + 1);
packer.add(PageType.editor, "editor-" + rname, Core.atlas.getPixmap(rname));
}
}
Pixmap last = null;
var gen = icons();
@@ -59,11 +59,7 @@ public class Wall extends Block{
@Override
public void draw(){
if(variants == 0){
Draw.rect(region, x, y);
}else{
Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], x, y);
}
super.draw();
//draw flashing white overlay if enabled
if(flashHit){
@@ -74,7 +74,6 @@ public class Floor extends Block{
public Floor(String name){
super(name);
variants = 3;
}
@@ -133,19 +132,12 @@ public class Floor extends Block{
@Override
public void createIcons(MultiPacker packer){
super.createIcons(packer);
packer.add(PageType.editor, "editor-" + name, Core.atlas.getPixmap(fullIcon).crop());
packer.add(PageType.editor, "editor-" + name, Core.atlas.getPixmap(fullIcon));
if(blendGroup != this){
return;
}
if(variants > 0){
for(int i = 0; i < variants; i++){
String rname = name + (i + 1);
packer.add(PageType.editor, "editor-" + rname, Core.atlas.getPixmap(rname).crop());
}
}
PixmapRegion image = Core.atlas.getPixmap(icons()[0]);
PixmapRegion edge = Core.atlas.getPixmap("edge-stencil");
Pixmap result = new Pixmap(edge.width, edge.height);