Hello Guest

Author Topic: Example on how to use triggers in TD2K?  (Read 4660 times)

clanssd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Example on how to use triggers in TD2K?
« on: December 25, 2014, 10:40:44 pm »
Is there an example on how to use triggers effectively for animations with TD2K? Do triggers in TD2K function similarly to triggers in the Unity animator? I've been digging through the online documentation and searching through posts here but I haven't been able to find a very fleshed out description of how they'd be used.

For some context on what I'm trying to do: I'm working on a side scrolling beat-em-up game and I'm having some difficulty figuring out the animation and game logic would come together without the code becoming an utter mess. This seems fairly straight forward using the Unity animator, however 2DTK works much better with the set of sprites I'm working with. I'm not looking for full code examples (although if there are any you know of that'd be great), just conceptual ideas on how to approach this problem. My observation so far is that TD2K animated sprites can't be controlled (in terms of what animation to play and when) with the animator component of Unity. Am I mistaken or am I just not comprehending the way its setup? Appreciate any feedback and Happy Holidays. :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Example on how to use triggers in TD2K?
« Reply #1 on: December 26, 2014, 12:27:49 pm »
You can have a trigger per animation frame in tk2d, when that frame is selected the trigger function is called. Check tk2dDemoAnimController (tk2d_Demo/ #5) where this is used.

clanssd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Example on how to use triggers in TD2K?
« Reply #2 on: December 27, 2014, 07:13:09 am »
Thanks for the response. Don't know why I didn't think to check the built-in examples as well. :) Looking through it, it seems pretty straight forward.