Skip to content

MelonFunction/ebiten-anim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ebiten-anim

Create a SpriteSheet to easily select parts of an image and create animations from them.

Usage

📖 Docs
Look at the example to see how to use the library.

// Create a spritesheet
SpriteSheet = anim.NewSpriteSheet(sprites, 8, 10, anim.SpriteSheetOptions{
    Scale: 16,
})

// Create an animation
frames := make([]anim.Frame, 5)
for x := 0; x <= 4; x++ {
    frames[x] = anim.NewFrame(SpriteSheet.GetSprite(x, 0), time.Second / 20)
}
Animation := anim.NewAnimation(frames)

// Update the animation
Animation.Update()

// Pause/play the animation
Animation.Pause()
Animation.Play()

// Draw the animation
Animation.Draw(screen, &ebiten.DrawImageOptions{})

// You can also just draw frames from the spritesheet without using animations
// This might be useful to avoid cluttering your Draw function with Image.SubImage
screen.DrawImage(SpriteSheet.GetSprite(0, 0), &ebiten.DrawImageOptions{})

About

Simple spritesheet and animation manager for ebiten

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages