Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#builder#300 default animtion bug #304

Closed

Conversation

JiepengTan
Copy link
Collaborator

fixed : #300

  1. The animation default (which is bound as defaultAnimation) is played only once while sprite in default state. It is expecetd to be played repeatedly (see details in spx: Animation binding builder#603 (comment))

  2. After animation fight (played by calling animate "fight") finished playing, the sprite does not return to the default state, while it keeps the last csotume of animation fight

default_anim_bug.mp4

@JiepengTan JiepengTan requested a review from nighca July 12, 2024 08:07
@@ -731,6 +738,9 @@ func (p *Sprite) goAnimate(name string, ani *aniConfig) {
}
})
waitToDo(animwg.Wait)
if isNeedPlayDefault {
p.playDefaultAnim()
Copy link
Collaborator

@nighca nighca Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no default animation (the sprite has its current costume). We should use the "current costume" of sprite instead of the last costume of the animation?

Comment on lines +194 to +195
"from": "__animation_fight_attack_1-1",
"to": "__animation_fight_attack_1-4",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried setting frameFrom & frameTo instead of from & to

Suggested change
"from": "__animation_fight_attack_1-1",
"to": "__animation_fight_attack_1-4",
"frameFrom": "__animation_fight_attack_1-1",
"frameTo": "__animation_fight_attack_1-4",

it panics:

panic: interface conversion: interface {} is nil, not string

goroutine 1 [running, locked to thread]:
github.com/goplus/spx.(*Sprite).init(0x140001e5e60, {0x14000325938?, 0x100dc3c08?}, 0x140000e4280, {0x1400052b510, 0x7}, 0x140001a3290, {0x100d8e6a0?, 0x140000e4280?, 0x10078e9f4?}, ...)
        /Users/nighca/code/goplus/spx/sprite.go:154 +0x904
github.com/goplus/spx.(*Game).loadSprite(0x140000e4280, {0x100dc53a0?, 0x140001e5e60}, {0x1400052b510, 0x7}, {0x100d8e6a0?, 0x140000e4280?, 0x10078e9f4?})
        /Users/nighca/code/goplus/spx/game.go:369 +0x2f4
github.com/goplus/spx.(*Game).newSpriteAndLoad(0x100d265c0?, {0x1400052b510, 0x7}, {0x100dcc848?, 0x100db98a0?}, {0x100d8e6a0?, 0x140000e4280?, 0x1011aea40?})
        /Users/nighca/code/goplus/spx/game.go:131 +0x94
github.com/goplus/spx.(*Game).getSpriteProtoByName(0x140000e4280, {0x1400052b510, 0x7}, {0x100d8e6a0?, 0x140000e4280?, 0x1007dfbd0?})
        /Users/nighca/code/goplus/spx/game.go:154 +0xfc
github.com/goplus/spx.(*Game).loadIndex(0x140000e4280, {0x100d8e6a0?, 0x140000e4280?, 0x100cb978b?}, 0x140001a31e0)
        /Users/nighca/code/goplus/spx/game.go:413 +0x3bc
github.com/goplus/spx.(*Game).endLoad(0x100d8e6a0?, {0x100d8e6a0?, 0x140000e4280?, 0x140004dfe38?}, 0x100beeb76?)
        /Users/nighca/code/goplus/spx/game.go:460 +0xb8
github.com/goplus/spx.Gopt_Game_Run({0x100dc1d28?, 0x140000e4280}, {0x100cfbc20?, 0x100dbfb28?}, {0x0, 0x0, 0x140002d9f01?})
        /Users/nighca/code/goplus/spx/game.go:269 +0x594
github.com/goplus/spx.Gopt_Game_Main({0x100dc1d28, 0x140000e4280}, {0x14000021160?, 0x0?, 0x140002d9f28?})
        /Users/nighca/code/goplus/spx/game.go:187 +0x98
main.(*Game).Main(...)
        /Users/nighca/code/goplus/spx/tutorial/bug_anim_nighca/gop_autogen.go:20
main.main()
        tutorial/bug_anim_nighca/Fighter.spx:29 +0x90
exit status 2
exit status 1

"fight": {
"from": "__animation_fight_attack_1-1",
"to": "__animation_fight_attack_1-4",
"duration": 0.4,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I set frameFps & duration at the same time:

Suggested change
"duration": 0.4,
"frameFps": 1,
"duration": 0.01,

it is expected that the frameFps controls the animation speed (one frame per second), and the duration does not take any effect on this animation (it takes effect only when bound to step)

While it does not work as expected now. It seems that the "fight" animation is played in 0.01 second, which is specified by duration.

@JiepengTan JiepengTan closed this Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Costume-group) Animation issues
2 participants