object

package
v0.0.0-...-9fc0885 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Animation types.
	AvatarIdle      AvatarAnimType = AvatarAnimType("idle")
	AvatarMove                     = AvatarAnimType("move")
	AvatarSpellCast                = AvatarAnimType("spell")
	AvatarCraftCast                = AvatarAnimType("craft")
	AvatarMelee                    = AvatarAnimType("melee")
	AvatarShoot                    = AvatarAnimType("shoot")
	AvatarKneel                    = AvatarAnimType("kneel")
	AvatarLie                      = AvatarAnimType("lie")
)

Variables

This section is empty.

Functions

func DefaultEffectGraphic

func DefaultEffectGraphic(eff *effect.Effect) *res.EffectGraphicData

DefaultEffectGraphic returns default graphic for specified effect.

func DefaultItemGraphic

func DefaultItemGraphic(it item.Item) *res.ItemGraphicData

DefaultItemGraphic returns default graphic for specified item.

func DefaultSkillGraphic

func DefaultSkillGraphic(skill *skill.Skill) *res.SkillGraphicData

DefaultSkillGraphic returns default graphic for specified skill.

Types

type Area

type Area struct {
	*area.Area
	// contains filtered or unexported fields
}

Graphical wrapper for area.

func NewArea

func NewArea(game *game.Game, area *area.Area, areaMap *stone.Map) *Area

NewArea returns new graphical wrapper for specified area.

func (*Area) AreaObjects

func (a *Area) AreaObjects() (objects []*ObjectGraphic)

AreaObjects returns all objects in current area.

func (*Area) Avatars

func (a *Area) Avatars() (avatars []*Avatar)

Avatars returns all avatars from current area.

func (*Area) Draw

func (a *Area) Draw(win *mtk.Window, matrix pixel.Matrix, size pixel.Vec)

Draw draws area.

func (*Area) Map

func (a *Area) Map() *stone.Map

Map returns area map.

func (*Area) PassablePosition

func (a *Area) PassablePosition(pos pixel.Vec) bool

PassablePosition checks if specified position is 'passable', i.e. map there is visible layer on this position where player is allowed to move(like 'ground' layer').

func (*Area) Update

func (a *Area) Update(win *mtk.Window)

Update updates area.

type Avatar

type Avatar struct {
	*game.Character
	// contains filtered or unexported fields
}

Avatar struct for graphical representation of game objects with multiple directional animations(idle, move, cast, meele, etc.).

func NewAvatar

func NewAvatar(char *game.Character, data *res.AvatarData) (*Avatar, error)

NewAvatar creates new avatar for specified game character from specified avatar resources. Returns error if spritesheets from data object(torso/head or full body) were not found in res/graphic avatar spritesheet map.

func (*Avatar) Data

func (av *Avatar) Data() res.AvatarData

Data returns avatar graphical data.

func (*Avatar) DestPoint

func (av *Avatar) DestPoint() pixel.Vec

DestPoint returns current destination point of avatar.

func (*Avatar) Draw

func (av *Avatar) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws avatar.

func (*Avatar) DrawArea

func (av *Avatar) DrawArea() pixel.Rect

DrawArea returns current draw area.

func (*Avatar) Effects

func (av *Avatar) Effects() (effects []*EffectGraphic)

Effects returns all visible effects active on avatar character.

func (*Avatar) Hovered

func (av *Avatar) Hovered() bool

Hovered check if avatar is hovered by HUD user mouse cursor.

func (*Avatar) Portrait

func (av *Avatar) Portrait() pixel.Picture

Portrait returns avatar portrait picture.

func (*Avatar) Position

func (av *Avatar) Position() pixel.Vec

Position returns current position of avatar.

func (*Avatar) SetPosition

func (av *Avatar) SetPosition(p pixel.Vec)

SetPosition sets current position of avatar.

func (*Avatar) Silence

func (av *Avatar) Silence(silence bool)

Silence toggles avatar audio effects.

func (*Avatar) Silenced

func (av *Avatar) Silenced() bool

Silenced checks if audio effects are silenced.

func (*Avatar) Skills

func (av *Avatar) Skills() (skills []*SkillGraphic)

Skills retruns all avatar skills(in form of graphical wrappers).

func (*Avatar) Update

func (av *Avatar) Update(win *mtk.Window)

Update updates avatar.

type AvatarAnimType

type AvatarAnimType string

Type for avatar animations types.

type Drawer

type Drawer interface {
	Position() pixel.Vec
	DrawArea() pixel.Rect
}

Interface for all objects with drawable objects.

type EffectGraphic

type EffectGraphic struct {
	*effect.Effect
	// contains filtered or unexported fields
}

Graphical wrapper for effects.

func NewEffectGraphic

func NewEffectGraphic(effect *effect.Effect, data *res.EffectGraphicData) *EffectGraphic

NewEffectGraphic creates new graphical wrapper for specified effect.

func (*EffectGraphic) DrawIcon

func (eg *EffectGraphic) DrawIcon(t pixel.Target, matrix pixel.Matrix)

DrawIcon draws effect icon and text label with remaining time(in seconds).

func (*EffectGraphic) Icon

func (eg *EffectGraphic) Icon() *pixel.Sprite

Icon returns effect icon.

type ItemGraphic

type ItemGraphic struct {
	item.Item
	// contains filtered or unexported fields
}

Struct for graphical wrapper for items.

func NewItemGraphic

func NewItemGraphic(item item.Item, data *res.ItemGraphicData) *ItemGraphic

NewItemGraphic creates new graphical wrapper for specified item.

func (*ItemGraphic) Icon

func (itg *ItemGraphic) Icon() pixel.Picture

Icon returns item icon.

func (*ItemGraphic) MaxStack

func (itg *ItemGraphic) MaxStack() int

MaxStack returns maximal number of stacked items with same ID.

func (*ItemGraphic) Spritesheets

func (itg *ItemGraphic) Spritesheets() []*res.SpritesheetData

Spritesheets returns all spritesheets data.

type ObjectGraphic

type ObjectGraphic struct {
	*character.Character
	// contains filtered or unexported fields
}

Struct for graphical representation of area object with single idle animation.

func NewObjectGraphic

func NewObjectGraphic(char *character.Character, data *res.ObjectGraphicData) (*ObjectGraphic, error)

NewObjectGraphic creates new object graphic for specified character. Returns error if sprite texture from data object was not found it res/graphic object spritesheets map.

func (*ObjectGraphic) CombatLog

func (og *ObjectGraphic) CombatLog() *objects.Log

ComabatLog retruns object comabt log.

func (*ObjectGraphic) Draw

func (og *ObjectGraphic) Draw(t pixel.Target, matrix pixel.Matrix)

Draw draws object sprite.

func (*ObjectGraphic) DrawArea

func (og *ObjectGraphic) DrawArea() pixel.Rect

DrawArea returns current draw area of object sprite.

func (*ObjectGraphic) Effects

func (og *ObjectGraphic) Effects() []*EffectGraphic

Effects returns all object effects in form of graphical wrappers.

func (*ObjectGraphic) Hovered

func (og *ObjectGraphic) Hovered() bool

Hovered checks if object is hovered by HUD user mouse cursor.

func (*ObjectGraphic) Items

func (og *ObjectGraphic) Items() (items []*ItemGraphic)

Items returns all object items(in form of graphical wrappers).

func (*ObjectGraphic) LootItems

func (og *ObjectGraphic) LootItems() (items []*ItemGraphic)

LootItems returns all 'lootable' items(in form of graphical wrappers).

func (*ObjectGraphic) MaxMana

func (og *ObjectGraphic) MaxMana() int

MaxMana returns 0, object do not have mana. Function to satify frame target interface.

func (*ObjectGraphic) Name

func (og *ObjectGraphic) Name() string

Name returns object name.

func (*ObjectGraphic) Portrait

func (og *ObjectGraphic) Portrait() pixel.Picture

Portrait returns portrait picture.

func (*ObjectGraphic) Position

func (og *ObjectGraphic) Position() pixel.Vec

Position return object position in form of pixel XY vector.

func (*ObjectGraphic) Silence

func (og *ObjectGraphic) Silence(silence bool)

Silence toggles object audio effects.

func (*ObjectGraphic) Silenced

func (og *ObjectGraphic) Silenced() bool

Silenced checks if audio effects are silenced.

func (*ObjectGraphic) Update

func (og *ObjectGraphic) Update(win *mtk.Window)

Update updates object.

type SkillGraphic

type SkillGraphic struct {
	*skill.Skill
	// contains filtered or unexported fields
}

Graphical wrapper for skills.

func NewSkillGraphic

func NewSkillGraphic(skill *skill.Skill, data *res.SkillGraphicData) *SkillGraphic

NewSkillGraphic creates new graphical wrapper for specified skill.

func (*SkillGraphic) ActivationAnim

func (sg *SkillGraphic) ActivationAnim() AvatarAnimType

ActivationAnim returns skill activation animation.

func (*SkillGraphic) ActivationAudio

func (sg *SkillGraphic) ActivationAudio() *beep.Buffer

AudioEffect returns skill audio effect.

func (*SkillGraphic) Icon

func (sg *SkillGraphic) Icon() pixel.Picture

Icon returns skill icon sprite.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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