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

feat(animation): add custom animation support #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DavideBruner
Copy link

This PR aims to enhance the functionality of this amazing library by introducing support for custom animations. Previously, the library provided predefined animations for common player actions such as idle, walk, run, jump, etc. With this update, users can now define and trigger their own custom animations tailored to their specific game requirements.

Key Updates:

  • AnimationSet: The AnimationSet type has been expanded to include support for custom actions. Users can now define custom animations alongside the existing predefined ones.
  • setCustomAnimation: A new function, setCustomAnimation, has been implemented into the store, to allow users to trigger custom animations during gameplay.

Usage Example:

import { useGame } from "ecctrl";

const animationSet = {
  idle: "Idle",
  walk: "Walk",
  run: "Run",
  .....
  // Custom actions
  custom: {
    fly: "Fly"
  }
};

// ...
const setCustomAnimation = useGame((state) => state.setCustomAnimation);
// ...
setCustomAnimation("fly");

@DavideBruner DavideBruner force-pushed the feat/custom_animations_support branch 3 times, most recently from c6bc82f to 91390c0 Compare April 23, 2024 18:27
- Extend AnimationSet type to include custom actions
- Implement setCustomAnimation function for invoking custom animations
@DavideBruner DavideBruner force-pushed the feat/custom_animations_support branch from 91390c0 to 0bdb11d Compare April 26, 2024 11:12
@ErdongChen-Andrew
Copy link
Member

Thank you, @DavideBruner! This is a great feature to have! I will need to do more testing on this and might need to make some adjustments to your code. 👍

@DavideBruner
Copy link
Author

Appreciate it @ErdongChen-Andrew I’d be more than happy to help with any additional testing or modifications needed. Just let me know how/if I can assist! Thank you!

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.

None yet

2 participants