behaviour_common

package
v0.0.0-...-aacbedc Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAnimationName = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation []*Frame

type Animations

type Animations map[string]*Animation

type Common

type Common struct {
	gm.Instancer
	Sprite     Sprite
	Position   r2.Point  // Position of the instance based on cartesian room
	Speed      r2.Point  // Velocity of the instance based on cartesian room
	Angle      float64   // Angle of the instance based on sprite anchor
	Scale      *r2.Point // Scale of the instance based on sprite anchor (Default (1, 1))
	IsDrawMask bool      // Draw instance's mask
}

func (*Common) Data

func (bhvr *Common) Data() gm.BehavioursData

func (*Common) Draw

func (bhvr *Common) Draw(screen *ebiten.Image)

func (*Common) IsInside

func (bhvr *Common) IsInside(pPos r2.Point) bool

func (*Common) PostInit

func (bhvr *Common) PostInit()

func (*Common) PreInit

func (bhvr *Common) PreInit()

func (*Common) TrasnformedMask

func (bhvr *Common) TrasnformedMask() Mask

type CommonsData

type CommonsData struct {
	gm.Instancer
	// contains filtered or unexported fields
}
var Data CommonsData

func (*CommonsData) Behaviour

func (data *CommonsData) Behaviour() gm.Behaviour

func (*CommonsData) ByInstance

func (data *CommonsData) ByInstance(indt gm.Object) *InstanceData

func (*CommonsData) DelInstance

func (data *CommonsData) DelInstance(indt gm.Object)

func (*CommonsData) PostUpdate

func (data *CommonsData) PostUpdate()

func (*CommonsData) PreUpdate

func (data *CommonsData) PreUpdate()

type Frame

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

func (*Frame) Anchor

func (bhvr *Frame) Anchor() r2.Point

func (*Frame) Image

func (bhvr *Frame) Image() *ebiten.Image

func (*Frame) Mask

func (bhvr *Frame) Mask() *Mask

func (*Frame) MaskType

func (bhvr *Frame) MaskType() MaskType

func (*Frame) RemoveMask

func (bhvr *Frame) RemoveMask() *Frame

func (*Frame) SetAnchor

func (bhvr *Frame) SetAnchor(p r2.Point) *Frame

func (*Frame) SetAnchorToggle

func (bhvr *Frame) SetAnchorToggle(pos FrameAnchorToggle) *Frame

func (*Frame) SetImage

func (bhvr *Frame) SetImage(image *ebiten.Image) *Frame

func (*Frame) SetMaskFill

func (bhvr *Frame) SetMaskFill() *Frame

func (*Frame) SetMaskRectangle

func (bhvr *Frame) SetMaskRectangle(mask r2.Rect) *Frame

type FrameAnchorToggle

type FrameAnchorToggle int
const (
	Sprite_FrameAnchor_ToggleTopLeft FrameAnchorToggle = iota
	Sprite_FrameAnchor_ToggleTopCenter
	Sprite_FrameAnchor_ToggleTopRight
	Sprite_FrameAnchor_ToggleMiddleLeft
	Sprite_FrameAnchor_ToggleMiddleCenter
	Sprite_FrameAnchor_ToggleMiddleRight
	Sprite_FrameAnchor_ToggleBottomLeft
	Sprite_FrameAnchor_ToggleBottomCenter
	Sprite_FrameAnchor_ToggleBottomRight
)

type InstanceData

type InstanceData struct{}

type Mask

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

func (Mask) GeoTransform

func (bhvr Mask) GeoTransform(geoM ebiten.GeoM) Mask

GeoTransform returns new Mask with already transformed by geoM

func (*Mask) MaskType

func (bhvr *Mask) MaskType() MaskType

func (Mask) OuterRectangle

func (bhvr Mask) OuterRectangle() r2.Rect

OuterRectangle returns rectangle that contain this mask

func (*Mask) Vectors

func (bhvr *Mask) Vectors() []r2.Point

type MaskType

type MaskType int
const (
	Sprite_MaskType_NoMask MaskType = iota
	Sprite_MaskType_Circle
	Sprite_MaskType_Recatangle
	Sprite_MaskType_Capsule
	Sprite_MaskType_ConvexHull
)

type Sprite

type Sprite struct {
	Animations       Animations
	CurrentAnimation string
	CurrentFrame     int
}

func (*Sprite) GetCurrentFrame

func (bhvr *Sprite) GetCurrentFrame() *Frame

func (*Sprite) InsertFrame

func (bhvr *Sprite) InsertFrame(animationName string, newFrames ...*Frame)

InsertFrame insert frame(s) at the end of the Animation named "animationName" by Image.

func (*Sprite) InsertFrameByImage

func (bhvr *Sprite) InsertFrameByImage(AnimationName string, images ...*ebiten.Image)

InsertFrameByImage insert frame(s) at the end of the Animation named "animationName" by Image.

func (*Sprite) PostInit

func (bhvr *Sprite) PostInit()

func (*Sprite) PreInit

func (bhvr *Sprite) PreInit()

Jump to

Keyboard shortcuts

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