til

package
v0.0.0-...-38e8959 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2019 License: Unlicense Imports: 8 Imported by: 8

Documentation

Overview

Package til implements access to TIL files.

The TIL file of each level (e.g. "levels/l1data/l1.til") specifies how to arrange dungeon pieces - the miniture tiles constructed from the level's MIN file - in order to form tiles. A tile consists of 4 dungeon pieces.

Below follows a pseudo-code description of the TIL file format.

// A TIL file consists of a sequence of tile definitions.
type TIL []Tile

// A Tile consists of four dungeon pieces (top, right, left, bottom),
// forming a square.
//
//     /\        1
//    /\/\      3 2
//    \/\/       4
//     \/
type Tile struct {
   // Dungeon piece ID at the top of the tile.
   Top uint16
   // Dungeon piece ID at the right of the tile.
   Right uint16
   // Dungeon piece ID at the left of the tile.
   Left uint16
   // Dungeon piece ID at the bottom of the tile.
   Bottom uint16
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tile

type Tile struct {
	// Dungeon piece ID at the top of the tile.
	Top uint16
	// Dungeon piece ID at the right of the tile.
	Right uint16
	// Dungeon piece ID at the left of the tile.
	Left uint16
	// Dungeon piece ID at the bottom of the tile.
	Bottom uint16
}

A Tile consists of four dungeon pieces (top, right, left, bottom), forming a square.

 /\        1
/\/\      3 2
\/\/       4
 \/

func Parse

func Parse(path string) ([]Tile, error)

Parse parses the given TIL file and returns its tile definitions.

func (Tile) Image

func (tile Tile) Image(dpieces []min.DPiece, levelFrames []image.Image) image.Image

Image returns an image representation of the tile. The dungeon pieces are arranged as illustrated below, forming a square:

       top

        /\
left   /\/\   right
       \/\/
        \/

      bottom

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL