Nerfed drone mined speed, new ore sprite packing
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Mech;
|
||||
@@ -67,8 +68,27 @@ public class Generators {
|
||||
Item item = ore.drops.item;
|
||||
Block base = ore.base;
|
||||
|
||||
//get base image to draw on
|
||||
Image image = context.get(base.name);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
//get base image to draw on
|
||||
Image image = context.get(base.name + (i+1));
|
||||
Image shadow = context.get(item.name + (i+1));
|
||||
|
||||
for (int x = 0; x < image.width(); x++) {
|
||||
for (int y = 1; y < image.height(); y++) {
|
||||
Color color = shadow.getColor(x, y - 1);
|
||||
|
||||
//draw semi transparent background
|
||||
if(color.a > 0.001f){
|
||||
color.set(0, 0, 0, 0.3f);
|
||||
image.draw(x, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image.draw(context.get(item.name + (i+1)));
|
||||
image.save("ore-" + item.name + "-" + base.name + (i+1));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -16,6 +17,7 @@ public class Image {
|
||||
|
||||
private BufferedImage image;
|
||||
private Graphics2D graphics;
|
||||
private Color color = new Color();
|
||||
|
||||
public Image(BufferedImage atlas, TextureRegion region){
|
||||
this.atlas = atlas;
|
||||
@@ -28,6 +30,25 @@ public class Image {
|
||||
toDispose.add(this);
|
||||
}
|
||||
|
||||
public int width(){
|
||||
return image.getWidth();
|
||||
}
|
||||
|
||||
public int height(){
|
||||
return image.getHeight();
|
||||
}
|
||||
|
||||
public Color getColor(int x, int y){
|
||||
int i = image.getRGB(x, y);
|
||||
Color.argb8888ToColor(color, i);
|
||||
return color;
|
||||
}
|
||||
|
||||
public void draw(int x, int y, Color color){
|
||||
graphics.setColor(new java.awt.Color(color.r, color.g, color.b, color.a));
|
||||
graphics.fillRect(x, y, 1, 1);
|
||||
}
|
||||
|
||||
/**Draws a region at the top left corner.*/
|
||||
public void draw(TextureRegion region){
|
||||
draw(region, 0, 0, false, false);
|
||||
|
||||
Reference in New Issue
Block a user