resources

package
v0.0.0-...-f4b0e07 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed ant.png
	Ant3Images_png []byte

	//go:embed arrow.png
	Arrow_png []byte

	//go:embed sugar.png
	Sugar_png []byte

	//go:embed sugar_sprite.png
	Sugar2_png []byte

	//go:embed ant_hill.png
	AntHill_png []byte

	//go:embed gotameme_single.png
	GoTameMe_png []byte

	//go:embed green_apple.png
	GreenApple_png []byte
)

Functions

func DecodeEbitenImage

func DecodeEbitenImage(data []byte) *ebiten.Image

Types

type AnimatedSprite

type AnimatedSprite struct {
	Image                     *ebiten.Image
	Position                  orb.Point
	ScreenWidth, ScreenHeight int
	FrameWidth, FrameHeight   int
	Animations                []Animation
	CurrentAnimation          int
	Count                     int
	//
	AnimationSpeed int
}

func NewAnimatedAnt

func NewAnimatedAnt(screenWidth, screenHeight int) AnimatedSprite

func NewAntHill

func NewAntHill(screenWidth, screenHeight int) AnimatedSprite

func NewGreenApple

func NewGreenApple(screenWidth, screenHeight int) AnimatedSprite

func NewSugar

func NewSugar(screenWidth, screenHeight int) AnimatedSprite

func (*AnimatedSprite) Bounds

func (a *AnimatedSprite) Bounds() (min, max [2]float64)

func (*AnimatedSprite) Draw

func (a *AnimatedSprite) Draw() *ebiten.Image

func (*AnimatedSprite) GetCenteredRotationOffset

func (a *AnimatedSprite) GetCenteredRotationOffset() (float64, float64)

GetCenteredRotationOffset calculates the offsets necessary for centering the rotation point of the sprite. This function is crucial for enabling the sprite to be rotated around its center, ensuring that rotations are visually centered and consistent. It returns the X and Y offsets based on the sprite's frame dimensions. These offsets are applied to adjust the rotation anchor point to the sprite's center, facilitating centered rotations within Ebiten's graphics framework.

func (*AnimatedSprite) GetPosition

func (a *AnimatedSprite) GetPosition() orb.Point

func (*AnimatedSprite) Update

func (a *AnimatedSprite) Update()

type Animation

type Animation struct {
	FrameOX    int
	FrameOY    int
	FrameCount int
}

type AnimationFunc

type AnimationFunc func(screen *ebiten.Image, image *ebiten.Image, elapsed float64)

type TimedAnimation

type TimedAnimation struct {
	Images     []*ebiten.Image
	ImageIndex int
	Timer      *time.Timer
	StartTime  time.Time
	AnimationFunc
}

func NewGoTameMeAnimation

func NewGoTameMeAnimation(screenWidth, screenHeight float64) *TimedAnimation

func NewTimedAnimation

func NewTimedAnimation(images []*ebiten.Image, animationFunc AnimationFunc) *TimedAnimation

func (*TimedAnimation) Draw

func (a *TimedAnimation) Draw(screen *ebiten.Image)

func (*TimedAnimation) GetCurrentImage

func (a *TimedAnimation) GetCurrentImage() *ebiten.Image

func (*TimedAnimation) Reset

func (a *TimedAnimation) Reset()

func (*TimedAnimation) Start

func (a *TimedAnimation) Start()

func (*TimedAnimation) Stop

func (a *TimedAnimation) Stop()

func (*TimedAnimation) Update

func (a *TimedAnimation) Update() bool

Jump to

Keyboard shortcuts

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