Documentation
¶
Index ¶
- Variables
- func MakeGrid(width, height int) [][]uint8
- type Generator
- func (g *Generator) CoalOreLayer(n int)
- func (g *Generator) DiamondOreLayer(n int)
- func (g *Generator) FillBedrockLayer()
- func (g *Generator) Generate()
- func (g *Generator) GoldOreLayer(n int)
- func (g *Generator) IronOreLayer(n int)
- func (g *Generator) RandomPointInRect(rect image.Rectangle) (int, int)
- func (g *Generator) SetSeed(seed int)
- func (g *Generator) StoneLayer()
- func (g *Generator) Surface()
- type TileMap
- func (t *TileMap) FindSpawnPosition() image.Point
- func (t *TileMap) FindSpawnPosition2(x, y int) image.Point
- func (t *TileMap) FloorToBlockCenter(x, y float64) v.Vec
- func (t *TileMap) GetID(x, y int) uint8
- func (t *TileMap) GetIDUnchecked(coords image.Point) uint8
- func (tm *TileMap) GetImage() *image.RGBA
- func (t *TileMap) GetImageByte() []byte
- func (t *TileMap) GetTileBottom(x, y int) float64
- func (t *TileMap) GetTileRect(x, y int) (rectX, rectY, rectW, rectH float64)
- func (t *TileMap) Raycast(pos image.Point, dirX, dirY, dist int) (image.Point, bool)
- func (t *TileMap) Set(x, y int, id uint8)
- func (t *TileMap) SetUnchecked(coord image.Point, id uint8)
- func (t *TileMap) TileIDProperty(x, y int) items.ItemProperty
- func (t *TileMap) TileToWorld(p image.Point) v.Vec
- func (t *TileMap) WorldToTile(x, y float64) image.Point
- func (t *TileMap) WorldToTile2(x, y float64) (int, int)
- type WorldOpts
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Generator ¶
type Generator struct {
NoiseState *fastnoise.State[float64]
PCG *rand.PCG
Rand *rand.Rand
Opts *WorldOpts
Tilemap TileMap
}
func NewGenerator ¶
func (*Generator) CoalOreLayer ¶
func (*Generator) DiamondOreLayer ¶
func (*Generator) FillBedrockLayer ¶
func (g *Generator) FillBedrockLayer()
func (*Generator) GoldOreLayer ¶
func (*Generator) IronOreLayer ¶
func (*Generator) RandomPointInRect ¶
func (*Generator) StoneLayer ¶
func (g *Generator) StoneLayer()
type TileMap ¶
func MakeTileMap ¶
func (*TileMap) FindSpawnPosition ¶
func (*TileMap) GetImageByte ¶
func (*TileMap) GetTileBottom ¶
func (*TileMap) GetTileRect ¶
func (*TileMap) TileIDProperty ¶
func (t *TileMap) TileIDProperty(x, y int) items.ItemProperty
func (*TileMap) TileToWorld ¶
Tile coords to block center
type WorldOpts ¶
type WorldOpts struct {
Seed int
SurfaceFlatness float64
HighestSurfaceLevel float64
LowestSurfaceLevel float64
HighestGoldLevel float64
LowestGoldLevel float64
HighestIronLevel float64
LowestIronLevel float64
HighestCoalLevel float64
LowestCoalLevel float64
HighestDiamondLevel float64
LowestDiamondLevel float64
}
func DefaultWorldOpts ¶
func DefaultWorldOpts() WorldOpts
Click to show internal directories.
Click to hide internal directories.