area

package
v0.0.0-...-ac9a988 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: GPL-2.0 Imports: 10 Imported by: 4

Documentation

Overview

Package with game area struct.

Index

Constants

This section is empty.

Variables

View Source
var PassableMapLayers = []string{"ground"}

List with names of the map layers on which the area objects can move.

Functions

This section is empty.

Types

type Area

type Area struct {
	Time time.Time
	// contains filtered or unexported fields
}

Area struct represents game world area.

func New

func New(data res.AreaData) *Area

New creates new area.

func (*Area) AddObject

func (a *Area) AddObject(o Object)

AddObjects adds specified object to area.

func (*Area) AddSubarea

func (a *Area) AddSubarea(sa *Area)

AddSubareas adds specified area to subareas.

func (*Area) AllObjects

func (a *Area) AllObjects() (objects []Object)

AllObjects retuns list with all objects in area and subareas.

func (*Area) AllSubareas

func (a *Area) AllSubareas() (subareas []*Area)

AllSubareas returns all subareas, including subareas of subareas

func (*Area) Apply

func (a *Area) Apply(data res.AreaData)

Apply applies specified data on the area.

func (*Area) Data

func (a *Area) Data() res.AreaData

Data returns area data resource.

func (*Area) ID

func (a *Area) ID() string

ID returns area ID.

func (*Area) Map

func (a *Area) Map() Map

Map returns area map.

func (*Area) NearObjects

func (a *Area) NearObjects(x, y, maxrange float64) (obs []Object)

NearObjects returns all objects within specified range from specified XY position.

func (*Area) Objects

func (a *Area) Objects() (objects []Object)

Objects returns list with all objects in area(excluding subareas).

func (*Area) RemoveObject

func (a *Area) RemoveObject(o Object)

RemoveObject removes specified object from area.

func (*Area) RemoveSubarea

func (a *Area) RemoveSubarea(sa *Area)

RemoveSubareas removes specified subobject.

func (*Area) SightRangeObjects

func (a *Area) SightRangeObjects(x, y float64) (obs []Object)

SightRangeObjects retuns all objects that have specified XY position in their sight range.

func (*Area) Subareas

func (a *Area) Subareas() (areas []*Area)

Subareas returns all subareas.

func (*Area) Update

func (a *Area) Update(delta int64)

Update updates area.

func (*Area) Weather

func (a *Area) Weather() *Weather

Weather retuns area weather.

type Conditions

type Conditions string

Type for area weather conditions.

const (
	Sunny Conditions = Conditions("weatherSunny")
	Rain             = Conditions("weatherRain")
)

type Layer

type Layer struct {
	// contains filtered or unexported fields
}

Struct for area map layer.

func (Layer) Name

func (l Layer) Name() string

Name returns layer name.

func (Layer) Tiles

func (l Layer) Tiles() []Tile

Tiles returns all layer tiles.

type Map

type Map struct {
	// contains filtered or unexported fields
}

Struct for area map.

func (Map) Data

func (m Map) Data() *tmx.Map

Data returns map data resource.

func (Map) Layers

func (m Map) Layers() []Layer

Layers returns all map layers.

func (Map) PositionLayer

func (m Map) PositionLayer(x, y float64) (layer Layer)

PositionLayer returns visible layer on specified XY position on the map.

func (Map) Size

func (m Map) Size() (int, int)

Size returns map size.

type Object

type Object interface {
	effect.Target
	Update(d int64)
	Live() bool
	Respawn() int64
	AreaID() string
	SetAreaID(s string)
	SightRange() float64
	Moving() bool
	DestPoint() (float64, float64)
	Interrupt()
	BaseMoveCooldown() int64
	MoveCooldown() int64
	SetMoveCooldown(c int64)
}

Interface for area objects.

type Respawn

type Respawn struct {
	// contains filtered or unexported fields
}

Struct for area respawn.

func (*Respawn) Apply

func (r *Respawn) Apply(data res.RespawnData)

Apply applies respawn data.

func (*Respawn) Data

func (r *Respawn) Data() res.RespawnData

Data returns data resource for respawn.

func (*Respawn) Update

func (r *Respawn) Update()

Update updates respawn.

type Tile

type Tile struct {
	// contains filtered or unexported fields
}

Struct for map tile.

func (Tile) Contains

func (t Tile) Contains(x, y float64) bool

Constains checks if specified XY posistion is contained inside the map tile.

type Weather

type Weather struct {
	Conditions Conditions
	// contains filtered or unexported fields
}

Struct for area weather.

Jump to

Keyboard shortcuts

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