Better commenting throughout
This commit is contained in:
@@ -11,10 +11,12 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
// Asset paths
|
||||
const (
|
||||
heroDir = "assets/hero"
|
||||
)
|
||||
|
||||
// Animation state
|
||||
type animState int
|
||||
|
||||
const (
|
||||
@@ -27,6 +29,7 @@ type animationKey struct {
|
||||
state animState
|
||||
}
|
||||
|
||||
// Sprite cache
|
||||
var (
|
||||
knightAnimations map[animationKey][]*ebiten.Image
|
||||
)
|
||||
@@ -47,6 +50,8 @@ func getKnightSprite(direction Direction, moving bool, frameIndex int) *ebiten.I
|
||||
return frameFromSet(direction, state, frameIndex)
|
||||
}
|
||||
|
||||
// Asset loading
|
||||
|
||||
func loadKnightAnimations() error {
|
||||
frames, err := loadAnimationFrames(heroDir)
|
||||
if err != nil {
|
||||
@@ -113,6 +118,8 @@ func loadImage(path string) (*ebiten.Image, error) {
|
||||
return ebiten.NewImageFromImage(img), nil
|
||||
}
|
||||
|
||||
// Image manipulation
|
||||
|
||||
func flipImageHorizontally(img *ebiten.Image) *ebiten.Image {
|
||||
bounds := img.Bounds()
|
||||
w, h := bounds.Dx(), bounds.Dy()
|
||||
|
||||
Reference in New Issue
Block a user