Documentation ¶
Index ¶
- Variables
- func DrawAt(canvas *ebiten.Image, ctx *context.Context, carrots *carrot.Inventory, ...)
- type Map
- func (self *Map) Collides(ctx *context.Context, carrots *carrot.Inventory, rect image.Rectangle, ...) bool
- func (self *Map) DeleteTile(row, col int, layerIndex int)
- func (self *Map) DrawBackLogical(canvas *ebiten.Image, ctx *context.Context, carrots *carrot.Inventory)
- func (self *Map) DrawFrontLogical(canvas *ebiten.Image, ctx *context.Context, carrots *carrot.Inventory)
- func (self *Map) DrawMainLogical(canvas *ebiten.Image, ctx *context.Context, carrots *carrot.Inventory)
- func (self *Map) ExportToString() (string, error)
- func (self *Map) GetFirstCollision(ctx *context.Context, carrots *carrot.Inventory, rect image.Rectangle, ...) (Tile, bool)
- func (self *Map) GetTileIDAt(row, col uint8, layer int) (uint8, bool)
- func (self *Map) HasLandingFor(ctx *context.Context, carrots *carrot.Inventory, ox, fx, y int, layer int) bool
- func (self *Map) LoadFromString(data string) error
- func (self *Map) SetTile(newTile Tile, layerIndex int)
- type Orientation
- func (self Orientation) ApplyToTileRect(rect image.Rectangle) image.Rectangle
- func (self Orientation) HasRotation() bool
- func (self Orientation) IsMirrored() bool
- func (self Orientation) Mirrored() Orientation
- func (self Orientation) RotatedLeft() Orientation
- func (self Orientation) RotatedRight() Orientation
- func (self Orientation) RotationDegs() int
- func (self Orientation) RotationStr() string
- type Tile
- func (self *Tile) Cmp(other Tile) int
- func (self *Tile) Collides(ctx *context.Context, carrots *carrot.Inventory, rect image.Rectangle) bool
- func (self *Tile) Draw(canvas *ebiten.Image, ctx *context.Context, carrots *carrot.Inventory)
- func (self *Tile) DrawAt(canvas *ebiten.Image, ctx *context.Context, carrots *carrot.Inventory, ...)
- func (self *Tile) EncodeToBytes(buffer []byte) []byte
- func (self *Tile) IsLandingFor(ctx *context.Context, carrots *carrot.Inventory, ox, fx, y int) bool
- func (self *Tile) RawRect() image.Rectangle
- func (self *Tile) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var CollisionFuncs [tcsts.GeometryMaxSentinel]func(ctx *context.Context, tileOrient Orientation, tileRect, targetRect image.Rectangle) bool
View Source
var LandingFuncs [tcsts.GeometryMaxSentinel]func(ctx *context.Context, tileOrient Orientation, tileRect image.Rectangle, ox, fx, y int) bool
Functions ¶
Types ¶
type Map ¶
type Map struct { Layers [][]Tile // for indexing, see tcsts.Layer* constants ID uint8 // can't be zero TransferIDs [3]uint8 // 0 means undefined, not allowed as a map ID StartRow uint8 StartCol uint8 }
Raw map structure. For actual play, we reorganize data a bit, as most content can be predrawn, and collisions can be prepared into a few 32x18 arrays.
func LoadMapFromString ¶
func (*Map) Collides ¶
func (self *Map) Collides(ctx *context.Context, carrots *carrot.Inventory, rect image.Rectangle, layer int) bool
Called like tilemap.Collides(ctx, rect, tcsts.LayerBack/LayerMain/LayerFront)
func (*Map) DeleteTile ¶
func (*Map) DrawBackLogical ¶
func (*Map) DrawFrontLogical ¶
func (*Map) DrawMainLogical ¶
func (*Map) ExportToString ¶
func (*Map) GetFirstCollision ¶
func (*Map) HasLandingFor ¶
func (*Map) LoadFromString ¶
type Orientation ¶
type Orientation uint8
func (Orientation) ApplyToTileRect ¶
func (self Orientation) ApplyToTileRect(rect image.Rectangle) image.Rectangle
func (Orientation) HasRotation ¶
func (self Orientation) HasRotation() bool
func (Orientation) IsMirrored ¶
func (self Orientation) IsMirrored() bool
func (Orientation) Mirrored ¶
func (self Orientation) Mirrored() Orientation
func (Orientation) RotatedLeft ¶
func (self Orientation) RotatedLeft() Orientation
func (Orientation) RotatedRight ¶
func (self Orientation) RotatedRight() Orientation
func (Orientation) RotationDegs ¶
func (self Orientation) RotationDegs() int
func (Orientation) RotationStr ¶
func (self Orientation) RotationStr() string
type Tile ¶
type Tile struct { ID uint8 Variation uint8 Orientation Orientation // only uses lowest 3 bits Row uint8 Column uint8 }
func DecodeTileFromBytes ¶
func (*Tile) EncodeToBytes ¶
func (*Tile) IsLandingFor ¶
Click to show internal directories.
Click to hide internal directories.