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

Animation Substate Expansion #1560

Open
Brushman97 opened this issue Sep 2, 2024 · 2 comments
Open

Animation Substate Expansion #1560

Brushman97 opened this issue Sep 2, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Brushman97
Copy link

Brushman97 commented Sep 2, 2024

Animation states are an essential element to GB Studio with plenty of events for it, but there's an aspect of them that isn't really talked about:
"substates"
(I don't know if there's an official name for these).
image

Currently, there's nothing much you can do with them. I have some ideas that would expand this rather obscure feature:

  • The ability to add substates to an animation state
  • The ability to remove substates from an animation state
  • An option to rename substates
  • A new event that allows you to change the player or actor's animation to a specific substate
  • The ability to copy and paste substates (Not just single frames or full states)
  • A new event that runs a script depending on an actor or player's animation substate (ex. "If Substate is Moving Right").
@Brushman97 Brushman97 added the enhancement New feature or request label Sep 2, 2024
@Steinbeuge
Copy link
Contributor

Big bump for being able to check the substate/animation state of an actor/player, that would be super useful

@Q-Bert-Reynolds
Copy link
Contributor

An animation state is just an array of 8 animations. Those "substates" are predefined names for the indices of the animations in an animation state array. Idle Right is always 0, Moving Right is always 4, Climbing is 6, but that's also Moving Up.

Less importantly, those 8 animations are just pointers to start and end frames in an array of metasprites, and if you have more than one animation state using the same tileset, all of the animation states point to the same array of metasprites, so if you know which frame your specific animation starts on, you can use Set Animation Frame to play that animation.

The only real differences between animation types is which ones get flipped automatically. The rest is just the different scene types using the animation clips in different ways. For example, if you use a platformer animation in a top down scene, you'll see the jump right animation when you face up, the jump left animation when you face down, the climb animation when you're walking up, and nothing when you walk down. This is because the top down game uses actor_set_dir (which sets both the animation frame and the actor's direction) for any movement, and platformer only uses actor_set_dir for left and right movement and actor_set_anim for everything else so that the actor's direction is preserved.

In my platformer, I needed to be able to look up and down while moving left and right, so I used the regular platformer animation type, but I modified the animation exporter so that it also flipped the climb animation and put it in slot 7.

Perhaps a good first step is just adding a generic animation state type with 8 numbered slots so it's more clear what's really going on... also copy paste.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants