diff options
| author | Physcik <mynameisgennadiy@vk.com> | 2026-01-07 02:42:09 +0500 |
|---|---|---|
| committer | Physcik <mynameisgennadiy@vk.com> | 2026-01-07 02:42:09 +0500 |
| commit | b2895f2e9f64cf7cc593130980747b045f6abee8 (patch) | |
| tree | b1b3862bf835050bfbab573288248de37d5a0d2e /engine/Components/World/Descriptor.go | |
| parent | 284b235a8f7672090bc4f31e56d451bb21d8ee55 (diff) | |
Build system + world gen settings
Diffstat (limited to 'engine/Components/World/Descriptor.go')
| -rw-r--r-- | engine/Components/World/Descriptor.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/engine/Components/World/Descriptor.go b/engine/Components/World/Descriptor.go new file mode 100644 index 0000000..553aa5b --- /dev/null +++ b/engine/Components/World/Descriptor.go @@ -0,0 +1,29 @@ +package world + +import rl "github.com/gen2brain/raylib-go/raylib" + +type Descriptor struct { + TileSize rl.Vector2 + Textures map[int]string `json:"textures"` + WorldMap [][]TileDescriptor `json:"worldmap"` +} + +func (base *Descriptor) GenerateMap() *World { + var outp = &World { + TileSize: base.TileSize, + TextureNames: base.Textures, + Tiles: make([][]Tile, len(base.WorldMap)), + } + for x := range base.WorldMap { + outp.Tiles[x] = make([]Tile, len(base.WorldMap[x])) + for y, tile := range base.WorldMap[x] { + outp.Tiles[x][y] = &StandardTile { + X: float32(x), + Y: float32(y), + ParentWorld: outp, + Descriptor: tile, + } + } + } + return outp +} |
