Better commenting throughout

This commit is contained in:
2025-11-24 12:29:19 -07:00
parent 175479da69
commit 5e0413a259
14 changed files with 107 additions and 195 deletions

View File

@@ -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()