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

(Costume-group) Animation issues #300

Closed
nighca opened this issue Jul 4, 2024 · 3 comments
Closed

(Costume-group) Animation issues #300

nighca opened this issue Jul 4, 2024 · 3 comments

Comments

@nighca
Copy link
Collaborator

nighca commented Jul 4, 2024

Project: animation.zip

For sprite Fighter:

Config:

{
  "fAnimations": {
    "fight": {
      "from": "__animation_fight_attack_1-1",
      "to": "__animation_fight_attack_1-4",
      "duration": 0.4,
      "anitype": 0
    },
    "dying": {
      "from": "__animation_dying_dead-1",
      "to": "__animation_dying_dead-3",
      "duration": 0.6,
      "anitype": 0
    },
    "walk": {
      "from": "__animation_walk_walk-1",
      "to": "__animation_walk_walk-8",
      "duration": 0.8,
      "anitype": 0
    },
    "default": {
      "from": "__animation_default_idle-1",
      "to": "__animation_default_idle-6",
      "duration": 0.6,
      "anitype": 0
    }
  },
  "defaultAnimation": "default",
  "animBindings": {
    "die": "dying",
    "step": "walk"
  }
}

Code:

onKey KeyUp, => {
    say "animate fight", 0.3
    animate "fight"
}

onKey KeyDown, => {
    say "die", 0.3
    die
}

onKey KeyLeft, => {
    say "step left"
    setRotationStyle LeftRight
    turnTo Left
    step 50
}

onKey KeyRight, => {
    say "step right"
    setRotationStyle LeftRight
    turnTo Right
    step 50
}

There are some issues:

  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

  3. If we call step 50, it is expected to play animation walk (which is bound to state step). However, the sprite plays fight, and then die, and then walk, and then panic:

    panic: invalid costume index [recovered]
        panic: invalid costume index
    
@nighca
Copy link
Collaborator Author

nighca commented Jul 9, 2024

  1. To make it possible to bind one animation to multiple states at the same time, we should put all animations in one place, e.g., fAnimations.

@nighca
Copy link
Collaborator Author

nighca commented Jul 12, 2024

Now in builder, all the animations are frame animations, based on #303 we do configure like this:

  • Set frameFrom & frameTo to specify frames, do not set from & to

  • Set duration to a fixed value (whatever the project or sprite or animation is), which corresponds to the time cost for sprite to move distance 1

    P.S. For animations bound to state turn, duration corresponds to the time cost for sprite to turn by 1 degree. For now we do not support state turn in Builder.

  • Set frameFps to control the speed of frame animation, do not set fps

  • Do not set anitype

@nighca
Copy link
Collaborator Author

nighca commented Aug 16, 2024

fixed by #303

@nighca nighca closed this as completed Aug 16, 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 a pull request may close this issue.

1 participant