invert logic in AnimRef.Anim

This commit is contained in:
Josh Deprez 2021-08-12 04:45:23 +00:00
parent d612cf3e54
commit c6ead101bd

View file

@ -30,13 +30,14 @@ func (r *AnimRef) Anim() *Anim {
if r.anim != nil { if r.anim != nil {
return r.anim return r.anim
} }
if ad := AnimDefs[r.Key]; ad != nil { ad := AnimDefs[r.Key]
r.anim = &Anim{Def: ad} if ad == nil {
return r.anim
}
log.Fatalf("Unknown AnimDef %q", r.Key) log.Fatalf("Unknown AnimDef %q", r.Key)
return nil return nil
} }
r.anim = &Anim{Def: ad}
return r.anim
}
// ImageRef loads images from the AssetFS into *ebiten.Image form. // ImageRef loads images from the AssetFS into *ebiten.Image form.
// It is your responsibility to import _ "image/..." for whatever // It is your responsibility to import _ "image/..." for whatever