util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollisionWorld common.CollisionGroup = 1 << iota
	CollisionPlayer
	CollisionEntity
)

Variables

View Source
var CharacterAnimations = []*common.Animation{
	{Name: action.AnimationMoveUp, Frames: []int{9, 10, 11}, Loop: true},
	{Name: action.AnimationMoveDown, Frames: []int{0, 1, 2}, Loop: true},
	{Name: action.AnimationMoveLeft, Frames: []int{3, 4, 5}, Loop: true},
	{Name: action.AnimationMoveRight, Frames: []int{6, 7, 8}, Loop: true},
	{Name: action.AnimationStopUp, Frames: []int{10}, Loop: true},
	{Name: action.AnimationStopDown, Frames: []int{1}, Loop: true},
	{Name: action.AnimationStopLeft, Frames: []int{4}, Loop: true},
	{Name: action.AnimationStopRight, Frames: []int{7}, Loop: true},
}

CharacterAnimations delcares default Character Animations.

Functions

This section is empty.

Types

type Character added in v0.5.0

Character entity is a game character.

func NewCharacter added in v0.5.0

func NewCharacter(o NewCharacterOptions) (p *Character, err error)

NewCharacter constructs a new Character entity and returns it along with any errors encountered.

type NewCharacterOptions added in v0.5.0

type NewCharacterOptions struct {
	Position              engo.Point
	SpritesheetURL        string
	CellWidth, CellHeight int
	CollisionGroup        common.CollisionGroup
	AnimationRate         float32
	StartZIndex           float32
}

NewCharacterOptions provides control options when calling NewCharacter.

type Object

An Object within the game world.

type Shadow added in v0.5.0

Shadow entity is an entity shadow.

func NewCharacterShadow added in v0.5.0

func NewCharacterShadow(character *Character) (*Shadow, error)

type Tile

A Tile entity stores the contents of a single tile of the game map.

type Tilemap

type Tilemap struct {
	Level *common.Level

	// Tiles contains all tiles from the map.
	Tiles []*Tile

	// Objects contains all objects from the map.
	Objects []*Object

	// Points contains objects of type Point.
	Points map[string]*Object

	// Spawns contains objects of type Spawn.
	Spawns map[string]*Object
}

A Tilemap entity stores the data for a single Tiled map.

func NewTilemap

func NewTilemap(url string) (tm *Tilemap, err error)

NewTilemap constructs a new Tilemap from the provided file url.

func (Tilemap) AddTilesToWorld

func (t Tilemap) AddTilesToWorld(w *ecs.World)

AddTilesToWorld adds each Tile entity to the given world.

Jump to

Keyboard shortcuts

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