Merge pull request #31 from karl-tye/karl-tye/play-animation-error

Only Return Error on Animation Not Found
main
SolarLune 2024-01-06 08:19:16 -08:00 committed by GitHub
commit 03b14876c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 10 deletions

View File

@ -375,10 +375,11 @@ func (ap *AnimationPlayer) PlayAnim(animation *Animation) {
// it will return an error.
func (ap *AnimationPlayer) Play(animationName string) error {
anim, ok := ap.RootNode.Library().Animations[animationName]
if ok {
ap.PlayAnim(anim)
if !ok {
return errors.New("Animation named {" + animationName + "} not found in node's owning Library")
}
return errors.New("Animation named {" + animationName + "} not found in node's owning Library")
ap.PlayAnim(anim)
return nil
}
// Stop stops the AnimationPlayer's playback. Note that this is fundamentally the same as calling ap.Playing = false (for now).

View File

@ -4,8 +4,6 @@ import (
"bytes"
"embed"
_ "embed"
"github.com/solarlune/tetra3d"
"github.com/solarlune/tetra3d/colors"
"github.com/solarlune/tetra3d/examples"

View File

@ -2,7 +2,6 @@ package main
import (
"embed"
_ "embed"
"github.com/solarlune/tetra3d"
"github.com/solarlune/tetra3d/colors"

View File

@ -2,7 +2,6 @@ package main
import (
"embed"
_ "embed"
"github.com/solarlune/tetra3d"
"github.com/solarlune/tetra3d/colors"

View File

@ -2,7 +2,6 @@ package main
import (
"embed"
_ "embed"
"github.com/solarlune/tetra3d"
"github.com/solarlune/tetra3d/colors"

View File

@ -4,8 +4,6 @@ import (
"embed"
"strings"
_ "embed"
"github.com/solarlune/tetra3d"
"github.com/hajimehoshi/ebiten/v2"