New blocks

This commit is contained in:
Anuken
2019-01-27 23:26:07 -05:00
parent db2e6b6973
commit e9a82652a0
44 changed files with 1800 additions and 1838 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

View File

@@ -0,0 +1,44 @@
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define SPACE 2.0
uniform sampler2D u_texture;
uniform vec4 u_color;
uniform vec2 u_texsize;
uniform float u_scl;
varying vec4 v_color;
varying vec2 v_texCoord;
void main() {
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
vec4 c = texture2D(u_texture, v_texCoord.xy);
float spacing = SPACE * u_scl;
gl_FragColor = mix(vec4(0.0, 0.0, 0.0, min(c.a, u_color.a)), u_color,
(1.0-step(0.001, texture2D(u_texture, v_texCoord.xy).a)) *
step(0.001,
//cardinals
texture2D(u_texture, v_texCoord.xy + vec2(0, spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(0, -spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(spacing, 0) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, 0) * v).a +
//cardinal edges
texture2D(u_texture, v_texCoord.xy + vec2(spacing, spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(spacing, -spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, -spacing) * v).a +
//cardinals * 2
texture2D(u_texture, v_texCoord.xy + vec2(0, spacing) * v*2.0).a +
texture2D(u_texture, v_texCoord.xy + vec2(0, -spacing) * v*2.0).a +
texture2D(u_texture, v_texCoord.xy + vec2(spacing, 0) * v*2.0).a +
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, 0) * v*2.0).a
));
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 KiB

After

Width:  |  Height:  |  Size: 1013 KiB

View File

@@ -32,8 +32,8 @@ public class Blocks implements ContentList{
public static Block public static Block
//environment //environment
air, part, spawn, space, metalfloor, deepwater, water, tar, stone, craters, charr, blackstone, dirt, sand, ice, snow, air, part, spawn, space, metalfloor, deepwater, water, tar, stone, craters, charr, blackstone, dirt, sand, ice, snow, iceSnow,
grass, shrub, rock, icerock, blackrock, rocks, cliffs, pine, whiteTree, grass, holostone, holostoneSnow, shrub, rock, icerock, blackrock, rocks, icerocks, cliffs, pine, whiteTree, sporeCluster,
//crafting //crafting
siliconSmelter, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer, siliconSmelter, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
@@ -182,12 +182,15 @@ public class Blocks implements ContentList{
dragMultiplier = 0.2f; dragMultiplier = 0.2f;
speedMultiplier = 0.4f; speedMultiplier = 0.4f;
minimapColor = Color.valueOf("b8eef8"); minimapColor = Color.valueOf("b8eef8");
hasOres = true;
}}; }};
snow = new Floor("snow"){{ snow = new Floor("snow"){{
minimapColor = Color.valueOf("c2d1d2"); minimapColor = Color.valueOf("c2d1d2");
hasOres = true; }};
iceSnow = new Floor("ice-snow"){{
minimapColor = Color.valueOf("c2d1d2");
variants = 3;
}}; }};
grass = new Floor("grass"){{ grass = new Floor("grass"){{
@@ -197,24 +200,16 @@ public class Blocks implements ContentList{
shrub = new Rock("shrub"); shrub = new Rock("shrub");
rock = new Rock("rock"){{
variants = 2;
}};
cliffs = new StaticWall("cliffs"){{ cliffs = new StaticWall("cliffs"){{
variants = 1; variants = 1;
fillsTile = false; fillsTile = false;
}}; }};
icerock = new Rock("icerock"){{ rocks = new StaticWall("rocks"){{
variants = 2; variants = 2;
}}; }};
blackrock = new Rock("blackrock"){{ icerocks = new StaticWall("icerocks"){{
variants = 1;
}};
rocks = new StaticWall("rocks"){{
variants = 2; variants = 2;
}}; }};
@@ -226,6 +221,18 @@ public class Blocks implements ContentList{
whiteTree = new TreeBlock("white-tree-dead"){{ whiteTree = new TreeBlock("white-tree-dead"){{
}}; }};
sporeCluster = new Rock("spore-cluster"){{
variants = 3;
}};
holostone = new Floor("holostone"){{
hasOres = true;
}};
holostoneSnow = new Floor("holostone-snow"){{
}};
//endregion //endregion
//region crafting //region crafting

View File

@@ -5,6 +5,7 @@ import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.game.Rules; import io.anuke.mindustry.game.Rules;
import io.anuke.mindustry.game.SpawnGroup; import io.anuke.mindustry.game.SpawnGroup;
import io.anuke.mindustry.maps.generators.MapGenerator; import io.anuke.mindustry.maps.generators.MapGenerator;
import io.anuke.mindustry.maps.generators.MapGenerator.Decoration;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Zone; import io.anuke.mindustry.type.Zone;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -58,7 +59,7 @@ public class Zones implements ContentList{
}}; }};
}}; }};
craters = new Zone("craters", new MapGenerator("craters", 1){{ distortion = 0; }}){{ craters = new Zone("craters", new MapGenerator("craters", 1).dist(0)){{
deployCost = ItemStack.with(Items.copper, 300); deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200); startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15; conditionWave = 15;
@@ -106,7 +107,8 @@ public class Zones implements ContentList{
}}; }};
}}; }};
frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest")){{ //TODO implement frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest")
.decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.05))){{
alwaysUnlocked = true; alwaysUnlocked = true;
deployCost = ItemStack.with(Items.copper, 300); deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200); startingItems = ItemStack.with(Items.copper, 200);

View File

@@ -172,6 +172,11 @@ public class Renderer implements ApplicationListener{
blocks.processBlocks(); blocks.processBlocks();
blocks.drawShadows(); blocks.drawShadows();
blocks.floor.beginDraw();
blocks.floor.drawLayer(CacheLayer.walls);
blocks.floor.endDraw();
blocks.drawBlocks(Layer.block); blocks.drawBlocks(Layer.block);
blocks.drawFog(); blocks.drawFog();

View File

@@ -134,17 +134,21 @@ public class MapRenderer implements Disposable{
mesh.draw(idxWall, region, wx * tilesize, wy * tilesize, 8, 8); mesh.draw(idxWall, region, wx * tilesize, wy * tilesize, 8, 8);
} }
float offsetX = -(wall.size/3)*tilesize, offsetY = -(wall.size/3) * tilesize;
if(wall.update || wall.destructible){ if(wall.update || wall.destructible){
mesh.setColor(team.color); mesh.setColor(team.color);
region = Core.atlas.find("block-border"); region = Core.atlas.find("block-border");
}else if(!wall.synthetic() && bw != 0){ }else if(!wall.synthetic() && bw != 0){
region = wall.icon(Icon.full) == Core.atlas.find("____") ? Core.atlas.find("clear") : wall.icon(Icon.full); region = wall.icon(Icon.full) == Core.atlas.find("____") ? Core.atlas.find("clear") : wall.icon(Icon.full);
offsetX = tilesize/2f - region.getWidth()/2f * Draw.scl;
offsetY = tilesize/2f - region.getHeight()/2f * Draw.scl;
}else{ }else{
region = Core.atlas.find("clear"); region = Core.atlas.find("clear");
} }
mesh.draw(idxDecal, region, mesh.draw(idxDecal, region,
wx * tilesize - (wall.size/3) * tilesize, wy * tilesize - (wall.size/3) * tilesize, wx * tilesize + offsetX, wy * tilesize + offsetY,
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl); region.getWidth() * Draw.scl, region.getHeight() * Draw.scl);
mesh.setColor(Color.WHITE); mesh.setColor(Color.WHITE);
} }

View File

@@ -100,18 +100,21 @@ public class BlockRenderer{
public void drawShadows(){ public void drawShadows(){
if(disableShadows) return; if(disableShadows) return;
Draw.color();
if(!Core.graphics.isHidden() && (shadows.getWidth() != Core.graphics.getWidth() || shadows.getHeight() != Core.graphics.getHeight())){ if(!Core.graphics.isHidden() && (shadows.getWidth() != Core.graphics.getWidth() || shadows.getHeight() != Core.graphics.getHeight())){
shadows.resize(Core.graphics.getWidth(), Core.graphics.getHeight()); shadows.resize(Core.graphics.getWidth(), Core.graphics.getHeight());
} }
Tmp.tr1.set(shadows.getTexture()); Tmp.tr1.set(shadows.getTexture());
Shaders.outline.color.set(shadowColor); Shaders.shadow.color.set(shadowColor);
Shaders.outline.scl = renderer.cameraScale()/3f; Shaders.shadow.scl = renderer.cameraScale()/3f;
Shaders.outline.region = Tmp.tr1; Shaders.shadow.region = Tmp.tr1;
Draw.flush(); Draw.flush();
shadows.begin(); shadows.begin();
Core.graphics.clear(Color.CLEAR); Core.graphics.clear(Color.CLEAR);
floor.beginDraw(); floor.beginDraw();
floor.drawLayer(CacheLayer.walls); floor.drawLayer(CacheLayer.walls);
floor.endDraw(); floor.endDraw();
@@ -127,7 +130,7 @@ public class BlockRenderer{
Draw.flush(); Draw.flush();
shadows.end(); shadows.end();
Draw.shader(Shaders.outline); Draw.shader(Shaders.shadow);
Draw.rect(Draw.wrap(shadows.getTexture()), Draw.rect(Draw.wrap(shadows.getTexture()),
camera.position.x, camera.position.x,
camera.position.y, camera.position.y,
@@ -188,10 +191,6 @@ public class BlockRenderer{
lastCamY = avgy; lastCamY = avgy;
lastRangeX = rangex; lastRangeX = rangex;
lastRangeY = rangey; lastRangeY = rangey;
floor.beginDraw();
floor.drawLayer(CacheLayer.walls);
floor.endDraw();
} }
public void drawBlocks(Layer stopAt){ public void drawBlocks(Layer stopAt){
@@ -206,9 +205,7 @@ public class BlockRenderer{
Block block = req.tile.block(); Block block = req.tile.block();
if(req.layer == Layer.shadow){ if(req.layer == Layer.shadow){
Draw.color(0f, 0f, 0f, 0.45f);
block.drawShadow(req.tile); block.drawShadow(req.tile);
Draw.color();
}else if(req.layer == Layer.block){ }else if(req.layer == Layer.block){
block.draw(req.tile); block.draw(req.tile);
if(block.synthetic() && req.tile.getTeam() != players[0].getTeam()){ if(block.synthetic() && req.tile.getTeam() != players[0].getTeam()){

View File

@@ -12,6 +12,7 @@ import static io.anuke.mindustry.Vars.world;
public class Shaders{ public class Shaders{
public static Outline outline; public static Outline outline;
public static Shadow shadow;
public static BlockBuild blockbuild; public static BlockBuild blockbuild;
public static BlockPreview blockpreview; public static BlockPreview blockpreview;
public static Shield shield; public static Shield shield;
@@ -27,6 +28,7 @@ public class Shaders{
public static void init(){ public static void init(){
outline = new Outline(); outline = new Outline();
shadow = new Shadow();
blockbuild = new BlockBuild(); blockbuild = new BlockBuild();
blockpreview = new BlockPreview(); blockpreview = new BlockPreview();
shield = new Shield(); shield = new Shield();
@@ -130,6 +132,23 @@ public class Shaders{
} }
} }
public static class Shadow extends LoadShader{
public Color color = new Color();
public TextureRegion region = new TextureRegion();
public float scl;
public Shadow(){
super("shadow", "default");
}
@Override
public void apply(){
setUniformf("u_color", color);
setUniformf("u_scl", scl);
setUniformf("u_texsize", region.getTexture().getWidth(), region.getTexture().getHeight());
}
}
public static class BlockBuild extends LoadShader{ public static class BlockBuild extends LoadShader{
public Color color = new Color(); public Color color = new Color();
public float progress; public float progress;

View File

@@ -10,6 +10,7 @@ import io.anuke.mindustry.io.MapIO;
import io.anuke.mindustry.maps.Map; import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.maps.MapTileData; import io.anuke.mindustry.maps.MapTileData;
import io.anuke.mindustry.maps.MapTileData.TileDataMarker; import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.OreBlock; import io.anuke.mindustry.world.blocks.OreBlock;
import io.anuke.mindustry.world.blocks.storage.CoreBlock; import io.anuke.mindustry.world.blocks.storage.CoreBlock;
@@ -19,10 +20,9 @@ import static io.anuke.mindustry.Vars.*;
public class MapGenerator extends Generator{ public class MapGenerator extends Generator{
private Map map; private Map map;
private String mapName; private String mapName;
private Array<Decoration> decorations = new Array<>();
/**How much the landscape is randomly distorted.*/ /**How much the landscape is randomly distorted.*/
public float distortion = 3; public float distortion = 3;
/**The amount of final enemy spawns used. -1 to use everything in the map. /**The amount of final enemy spawns used. -1 to use everything in the map.
* This amount of enemy spawns is selected randomly from the map.*/ * This amount of enemy spawns is selected randomly from the map.*/
public int enemySpawns = -1; public int enemySpawns = -1;
@@ -36,6 +36,16 @@ public class MapGenerator extends Generator{
this.enemySpawns = enemySpawns; this.enemySpawns = enemySpawns;
} }
public MapGenerator decor(Decoration... decor){
this.decorations = Array.with(decor);
return this;
}
public MapGenerator dist(float distortion){
this.distortion = distortion;
return this;
}
@Override @Override
public void init(){ public void init(){
map = world.maps.loadInternalMap(mapName); map = world.maps.loadInternalMap(mapName);
@@ -75,10 +85,18 @@ public class MapGenerator extends Generator{
for(int x = 0; x < data.width(); x++){ for(int x = 0; x < data.width(); x++){
for(int y = 0; y < data.height(); y++){ for(int y = 0; y < data.height(); y++){
final double scl = 10; final double scl = 10;
Tile tile = tiles[x][y];
int newX = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x, y) * distortion + x), 0, data.width()-1); int newX = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x, y) * distortion + x), 0, data.width()-1);
int newY = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x + 9999, y + 9999) * distortion + y), 0, data.height()-1); int newY = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x + 9999, y + 9999) * distortion + y), 0, data.height()-1);
if(tiles[newX][newY].block() != Blocks.spawn && !tiles[x][y].block().synthetic()&& !tiles[newX][newY].block().synthetic()){
tiles[x][y].setBlock(tiles[newX][newY].block()); if(tiles[newX][newY].block() != Blocks.spawn && !tile.block().synthetic()&& !tiles[newX][newY].block().synthetic()){
tile.setBlock(tiles[newX][newY].block());
}
for(Decoration decor : decorations){
if(tile.block() == Blocks.air && tile.floor() == decor.floor && Mathf.chance(decor.chance)){
tile.setBlock(decor.wall);
}
} }
} }
} }
@@ -122,4 +140,16 @@ public class MapGenerator extends Generator{
world.prepareTiles(tiles); world.prepareTiles(tiles);
world.setMap(map); world.setMap(map);
} }
public static class Decoration{
public final Block floor;
public final Block wall;
public final double chance;
public Decoration(Block floor, Block wall, double chance){
this.floor = floor;
this.wall = wall;
this.chance = chance;
}
}
} }

View File

@@ -19,13 +19,11 @@ public class Rock extends Block{
@Override @Override
public void draw(Tile tile){ public void draw(Tile tile){
Draw.colorl(1f - tile.getRotation() / 4f);
if(variants > 0){ if(variants > 0){
Draw.rect(regions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, regions.length - 1))], tile.worldx(), tile.worldy()); Draw.rect(regions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, regions.length - 1))], tile.worldx(), tile.worldy());
}else{ }else{
Draw.rect(region, tile.worldx(), tile.worldy()); Draw.rect(region, tile.worldx(), tile.worldy());
} }
Draw.color();
} }
@Override @Override

View File

@@ -23,14 +23,11 @@ public class StaticWall extends Rock{
@Override @Override
public void draw(Tile tile){ public void draw(Tile tile){
//Draw.colorl(1f - tile.getRotation() / 4f);
int rx = tile.x / 2 * 2; int rx = tile.x / 2 * 2;
int ry = tile.y / 2 * 2; int ry = tile.y / 2 * 2;
if(Core.atlas.isFound(large) && eq(rx, ry) && Mathf.randomSeed(Pos.get(rx, ry)) < 0.5){ if(Core.atlas.isFound(large) && eq(rx, ry) && Mathf.randomSeed(Pos.get(rx, ry)) < 0.5){
if(rx == tile.x && ry == tile.y){ if(rx == tile.x && ry == tile.y){
//Draw.colorl(1f - avg(rx, ry) / 4f);
Draw.rect(large, tile.worldx() + tilesize/2f, tile.worldy() + tilesize/2f); Draw.rect(large, tile.worldx() + tilesize/2f, tile.worldy() + tilesize/2f);
} }
}else if(variants > 0){ }else if(variants > 0){
@@ -38,7 +35,6 @@ public class StaticWall extends Rock{
}else{ }else{
Draw.rect(region, tile.worldx(), tile.worldy()); Draw.rect(region, tile.worldx(), tile.worldy());
} }
// Draw.color();
} }
@Override @Override

View File

@@ -1,12 +1,13 @@
package io.anuke.mindustry.world.blocks; package io.anuke.mindustry.world.blocks;
import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.math.Mathf;
import io.anuke.mindustry.graphics.Layer; import io.anuke.mindustry.graphics.Layer;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
public class TreeBlock extends Block{ public class TreeBlock extends Block{
static final float shadowOffset = 5f; static final float shadowOffset = 10f;
public TreeBlock(String name){ public TreeBlock(String name){
super(name); super(name);
@@ -15,13 +16,17 @@ public class TreeBlock extends Block{
expanded = true; expanded = true;
} }
@Override
public void draw(Tile tile){}
@Override @Override
public void drawShadow(Tile tile){ public void drawShadow(Tile tile){
Draw.rect(region, tile.drawx() - shadowOffset, tile.drawy() - shadowOffset); Draw.rect(region, tile.drawx(), tile.drawy(), Mathf.randomSeed(tile.pos(), 0, 4) * 90);
Draw.rect(region, tile.drawx() - shadowOffset, tile.drawy() - shadowOffset, Mathf.randomSeed(tile.pos(), 0, 4) * 90);
} }
@Override @Override
public void drawLayer(Tile tile){ public void drawLayer(Tile tile){
Draw.rect(region, tile.drawx(), tile.drawy()); Draw.rect(region, tile.drawx(), tile.drawy(), Mathf.randomSeed(tile.pos(), 0, 4) * 90);
} }
} }

View File

@@ -15,6 +15,7 @@ def antialias = {File file ->
def image = ImageIO.read(file) def image = ImageIO.read(file)
def out = ImageIO.read(file) def out = ImageIO.read(file)
def getRGB = { int ix, int iy -> def getRGB = { int ix, int iy ->
//if(ix <= 0 || iy <= 0 || ix >= image.width || iy >= image.height) return 0
return image.getRGB(Math.max(Math.min(ix, image.width - 1), 0), Math.max(Math.min(iy, image.height - 1), 0)) return image.getRGB(Math.max(Math.min(ix, image.width - 1), 0), Math.max(Math.min(iy, image.height - 1), 0))
} }
@@ -112,6 +113,7 @@ task scaleSprites4x(){
def scaled = new BufferedImage(image.getWidth() * 2, image.getHeight() * 2, BufferedImage.TYPE_INT_ARGB) def scaled = new BufferedImage(image.getWidth() * 2, image.getHeight() * 2, BufferedImage.TYPE_INT_ARGB)
def getRGB = { int ix, int iy -> def getRGB = { int ix, int iy ->
//if(ix <= 0 || iy <= 0 || ix >= image.width || iy >= image.height) return 0
return image.getRGB(Math.max(Math.min(ix, image.width - 1), 0), Math.max(Math.min(iy, image.height - 1), 0)) return image.getRGB(Math.max(Math.min(ix, image.width - 1), 0), Math.max(Math.min(iy, image.height - 1), 0))
} }