Forum rules - please read before posting.

Player Trigger Animation

edited June 2014 in Technical Q&A
Hello
Im new Unity and learning adventure creator for Unity.
I am doing a 2d game.
I am doing a scene where i want the Player to go to a zone where it triggers an animition and sound.

So far, i was able to make the sound play when the player enters that zone using the AC_Trigger Script (Engine-Play Sound).
But i'm having some difficulty setting the animation to start.
(I've added a new action Object - Animate:
 and now i am confused. I don´t know wath the Type of Animation Engine I should use,
How to put the animation on an Object
and how do the Animator and Animation panels work)

What kind of animation engine should I use for a sprite sheet animation?
How do I setup the Object from its Static point to its triggered Animated Point?

Also, I am getting this error in the Console Panel:
NullReferenceException: Object reference not set to an instance of an object
AC_Trigger.OnTriggerEnter2D (UnityEngine.Collider2D other) (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:53)

Thanks a lot for your time.
Kezmar

Comments

  • Hello and welcome to the AC

    Well thats a really wide topic to adress to. So we better get going :)

    Since you have sprite sheet, your Object-Animate should be Sprites Unity . If you have a complex animation with many parts, you might work with Sprites Unity Complex but eithercase you can choose your Animation Engine with sprite options.

    When you got a Sprite Sheet, you need to identify them in Unity.  There are few tutorials that helped me alot when i first started Unity. here they are

    And here 

    These will clearly explain how to use sprite sheets and animations as well as Animator panels.

  • Thank You Very Much
    @Harkenin

    I do get it how one can assemble various animation and defining them to different states from the Sprite Sheet using the Animation and Animator tabs.

    But still I wasn't able to make it work when I run the Scene.

    Objective: When Brain hits a zone, A bird comes out of the woods

    The AC_Trigger plays a sound when Brain enters its zone, Engine - Play Sound (that is working. I even put a dialogue line, Dialogue- Play Speech)
    but,
    using the Object-Animate with Sprite Unity mode choosing the Animation Asset and the defined Clip
    I dont see the bird flying from the woods animation appearing on the scene.

    I've tried a different approach now:

    After the Play Sound Action I've selected the Run Cutscene option.
    Created a CutScene with only the animation, again using Object-Animate with Sprite Unity mode choosing the Animation Asset and the defined Clip
    But I dont see the bird flying from the woods when I run the scene.


    I must be doing something wrong.

    Help?Thank You


  • @ChrisIceBox
    Could you help me?

    i am having problems setting objects to animate.

  • Please don't re-post in another thread - this is the right place.  With a little patience, and we'll see you get the help you need.

    It's not clear from your description what you've done so far.  If you can post screenshots of the Bird's Animator, the Action that's not working, and the Bird inspector, people will better be able to help you.
  • Ok! I apologize for the inconvenience. Won´t happen again.
    Here is screenshot of what I've done.
    image
    image
    Thanks!!
  • No problem.  From what I can see, you don't need to have the "StepZoneLeft" parameter if your Object: Animate Action's method is Play Custom.  You also don't need to have a transition from your Static to Fly animations - the Play Custom will do this automatically anyway.

    And from the looks of your screenshot, the Fly animation is indeed playing! (In the FSM, anyway).  Is the blue "timeline" of the animation playing properly, or is it stuck at the far left?

    An alternative method would be to change the Action's Animation engine to Sprites Unity Complex.  You can then select the method Change Parameter Value, which you can use to enable a bool parameter.  If you have a transition from your Static to the Fly animation that plays when the bool is set to true, you can use the Action to turn this bool on, and trigger the animation that way.
  • Thanks @ChrisIceBox
    It is working now. I used Sprites Unity Complex and the animation is triggered when the player hits the zone of the Trigger Object.
    The animation was playing in a loop, so i ve added a transition from RavenFly to a new state RavenOut so the animation stopped after it came to its end.


  • @ChrisIceBox What do you suggest to be done if one would like the player to also animate when he steps the zone and trigggers the Raven's Flight?


  • The same principal will work for the player, only you should use the Character: Animate Action instead, and check the Is Player? checkbox.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.