avatar

package
v0.0.0-...-5198b88 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Avatar

type Avatar struct {
	CanvasImage          *canvas.Image
	CanvasPath           string
	Coord                coord.Coord
	ObjectInMapContainer *fyne.CanvasObject
}

func New

func New(avatar Avatar) Avatar

New create a new Avatar.

func Spawn

func Spawn(avatar Avatar, coord coord.Coord) Avatar

Spawn create a copy of an Avatar on given x,y coordinates.

func (*Avatar) CollideWithPlayer

func (subject *Avatar) CollideWithPlayer(futurePosX, futurePosY int) bool

CollideWithPlayer returns true if we are going to collide with player, false instead.

func (*Avatar) Copy

func (subject *Avatar) Copy() Avatar

Copy creates a new Avatar with the same properties.

func (*Avatar) DistanceFromAvatar

func (subject *Avatar) DistanceFromAvatar(subject2 *Avatar) float64

DistanceFromAvatar computes the distance between 2 Avatars.

func (*Avatar) Draw

func (subject *Avatar) Draw(mapContainer *fyne.Container)

Draw displays an avatar's image on the mapContainer.

func (*Avatar) Move

func (subject *Avatar) Move(mapContainer *fyne.Container, futurePosX, futurePosY int)

Move moves avatar's coordinates and updates image position on map.

func (*Avatar) MoveTowardsAvatar

func (subject *Avatar) MoveTowardsAvatar(subject2 *Avatar) (int, int)

MoveTowardsAvatar is a trivial pathfinding algorithm for NPCs.

func (*Avatar) Refresh

func (subject *Avatar) Refresh()

Refresh allows to refresh Avatar Image in case it was removed (save/load).

Jump to

Keyboard shortcuts

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