public class MaskedShapeGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static GreasedRegion |
alwaysSolid |
static GreasedRegion |
potentialBody |
static GreasedRegion |
potentialSolid |
Starfish32RNG |
randomness |
GreasedRegion |
randomRegion |
static int[][] |
spaceship |
Constructor and Description |
---|
MaskedShapeGenerator() |
Modifier and Type | Method and Description |
---|---|
int[][] |
generate()
Returns an int array (12x12) where 0 represents empty space, 1 represents border, and 2 represents "body."
The seed will change each time this runs, producing different shapes each time.
|
int[][] |
generate(long seed)
Returns an int array (12x12) where 0 represents empty space, 1 represents border, and 2 represents "body."
Will use the specified seed for this generation.
|
int[][] |
generateInto(int[][] changing,
int xPos,
int yPos)
Returns a modified version of changing where 0 represents empty space, 1 represents border, and 2 represents
"body." Only a 12x12 area will be changed by this call, with its minimum x and y determined by xPos and yPos.
|
int[][] |
generateIntoShaded(int[][] changing,
int xPos,
int yPos)
Returns a modified version of changing where 0 represents empty space, 1 represents border, 2 represents shaded
"body,", 3 represents normal body, and 4 represents lit body.
|
int[][] |
generateIntoShaded8way(int[][] changing,
int xPos,
int yPos)
Returns a modified version of changing where 0 represents empty space, 1 represents border, 2 represents shaded
"body,", 3 represents normal body, and 4 represents lit body.
|
public static final int[][] spaceship
public static final GreasedRegion potentialBody
public static final GreasedRegion potentialSolid
public static final GreasedRegion alwaysSolid
public Starfish32RNG randomness
public final GreasedRegion randomRegion
public int[][] generateInto(int[][] changing, int xPos, int yPos)
changing
- an int array that will be altered if possiblexPos
- the minimum x to modify; the maximum will be xPos + 12, exclusiveyPos
- the minimum y to modify; the maximum will be yPos + 12, exclusivepublic int[][] generate()
public int[][] generate(long seed)
seed
- a long to use as the seed for this random shape.public int[][] generateIntoShaded(int[][] changing, int xPos, int yPos)
changing
- an int array that will be altered if possiblexPos
- the minimum x to modify; the maximum will be xPos + 12, exclusiveyPos
- the minimum y to modify; the maximum will be yPos + 12, exclusivepublic int[][] generateIntoShaded8way(int[][] changing, int xPos, int yPos)
changing
- an int array that will be altered if possiblexPos
- the minimum x to modify; the maximum will be xPos + 12, exclusiveyPos
- the minimum y to modify; the maximum will be yPos + 12, exclusiveCopyright © Eben Howard 2012–2022. All rights reserved.