update sprites

This commit is contained in:
Leonwang4234
2020-11-07 18:31:47 -08:00
parent b448b90999
commit d133709423
2 changed files with 31 additions and 3 deletions

View File

@@ -505,6 +505,32 @@ public class Generators{
}
}
//generate weapon stat UI
//TODO: optimize
Image base = new Image(image.width, image.height);
image.each((x, y) -> {
Color c = image.getColor(x, y);
base.draw(x, y, c.set(c.r, c.g, c.b, c.a * 0.2f));
});
for(int i = 0;i < type.weapons.size;i ++){
Weapon weapon = type.weapons.get(i);
if(weapon.flipSprite){
continue;
}
weapon.load();
Image finalBase = base.copy();
finalBase.draw(outline.get(ImagePacker.get(weapon.region)),
(int)(weapon.x / Draw.scl + base.width / 2f - weapon.region.width / 2f),
(int)(-weapon.y / Draw.scl + base.height / 2f - weapon.region.height / 2f),
weapon.flipSprite, false);
finalBase.save(type.name + "-weapon" + i);
}
}catch(IllegalArgumentException e){
Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage());
}