Documentation ¶
Overview ¶
Package simvillage_tiles is a tile based village simulation based on: https://ebiten.org/examples/tiles.html https://ebiten.org/examples/animation.html
Index ¶
Constants ¶
const (
TileItemRock = 141
)
Tile IDs of items.
Variables ¶
var ( ItemTypeRock = &ItemType{ Name: "Rock", Tile: TileItemRock, } )
Functions ¶
This section is empty.
Types ¶
type Creature ¶
type Creature struct {
// contains filtered or unexported fields
}
Creature represents a moving entity in the game.
func NewCreature ¶
NewCreature returns a new creature with the given position.
type DefaultWorld ¶
type DefaultWorld struct {
// contains filtered or unexported fields
}
DefaultWorld is the default chunk source.
func (*DefaultWorld) FetchChunk ¶
func (w *DefaultWorld) FetchChunk(x, y int) *MapChunk
FetchChunk is a function to fetch a chunk from the world.
func (*DefaultWorld) TileSet ¶
func (w *DefaultWorld) TileSet() *TileSet
TileSet returns the tileset used for this world.
type Destination ¶
Destination is a destination for a trigger. TODO: Add also destination map.
type Dimensions ¶
Dimensions represents the dimensions of a map.
func NewDimensions ¶
func NewDimensions(width, height int) Dimensions
NewDimensions returns a new Dimensions struct.
type FakeIndoorWorld ¶
type FakeIndoorWorld struct {
// contains filtered or unexported fields
}
FakeIndoorWorld is a fake indoor map.
func (*FakeIndoorWorld) FetchChunk ¶
func (w *FakeIndoorWorld) FetchChunk(x, y int) *MapChunk
func (*FakeIndoorWorld) TileSet ¶
func (w *FakeIndoorWorld) TileSet() *TileSet
TileSet returns the tileset used for this world.
type Game ¶
type Game struct { *MapCache // contains filtered or unexported fields }
Game represents the main game struct. TODO: Move creatures to the individual world structs. ... or add a pointer to each creature that points to its world, so all creatures everywhere are still updated.
type Item ¶
Item represents an item in the game.
This item has a base type but has additional properties like a position, etc.
type ItemType ¶
ItemType represents an type of an item.
func (*ItemType) NewInstance ¶
NewInstance returns a new item with the given type.
type Layer ¶
type Layer struct { Dimensions Tiles []int }
Layer represents a layer on the map. TODO: Provide a (bool) Collidable property which will determine if the layer will be checked in the collision detection. Note: This code is in part inspired by cxong's fantastic map generator https://github.com/cxong/gomapgen
type MapCache ¶
type MapCache struct { World // fetchChunk is a function to fetch a chunk from the source. // contains filtered or unexported fields }
MapCache provides a caching layer for serving MapChunks.
type MapChunk ¶
type MapChunk struct { Dimensions Ground *Layer // Ground or terrain. GroundOverlay *Layer // Overlays like carpets, scratchmarks, etc. Objects *Layer // Objects like stones, flowers, etc. Structures *Layer // Structures like walls, gates, fences, etc. Roof *Layer // Roof or ceiling. Items []*Item // Items in the current chunk. Triggers []Trigger // Position of the trigger in the current chunk. }
MapChunk represents a chunk of the map.
type TileSet ¶
type TileSet struct {
// contains filtered or unexported fields
}
TileSet is a convenience wrapper around locating tiles in a tileset. TODO: Add support for animations.
func NewTileSet ¶
type Trigger ¶
type Trigger struct { Position [2]int // Position of the trigger in the chunk. Destination // Teleport the user to this destination. }
Trigger represents an interaction trigger.
type World ¶
type World interface { FetchChunk(x, y int) *MapChunk // returns a specific chunk TileSet() *TileSet // returns the tileset for this world }
World is an interface providing chunks at the given coordinates. TODO: Add a function that returns the active creatures in this world. TODO: Add a function that retrieves a specific tile. This would allow us to get information on doors to other maps etc.