More map balance / Fixed 'oh no' on 5x5+ block destruction

This commit is contained in:
Anuken
2019-03-01 17:18:08 -05:00
parent 110def97d9
commit 1e111d29d9
3 changed files with 10 additions and 13 deletions

View File

@@ -11,27 +11,24 @@ public class RubbleDecal extends Decal{
private static final TextureRegion[][] regions = new TextureRegion[16][0];
private TextureRegion region;
/**
* Creates a rubble effect at a position. Provide a block size to use.
*/
/**Creates a rubble effect at a position. Provide a block size to use.*/
public static void create(float x, float y, int size){
if(headless) return;
if(regions[size].length == 0){
int i = 0;
for(; i < 2; i++){
if(!Core.atlas.has("rubble-" + size + "-" + i)){
break;
}
}
regions[size] = new TextureRegion[i + 1];
for(int j = 0; j <= i; j++){
regions[size] = new TextureRegion[2];
for(int j = 0; j < 2; j++){
regions[size][j] = Core.atlas.find("rubble-" + size + "-" + j);
}
}
RubbleDecal decal = new RubbleDecal();
decal.region = regions[size][Mathf.clamp(Mathf.randomSeed(decal.id, 0, 1), 0, regions[size].length - 1)];
if(!Core.atlas.isFound(decal.region)){
return;
}
decal.set(x, y);
decal.add();
}