Forum rules - please read before posting.

Talk while sitting down in 2D

Hello.
I’m trying to have the player sit down and have a conversation. I’m using sprites unity animation 2d.
My question is, which is the best way to do this?
I managed to play the sitting down animation in front of a chair, but as soon as the player does something (interact, walk or talk) it teleports to its normal animations (which is to be expected).
1. I would like to change to a different talking animation when sitting down (sitting_down_talking or something), but can’t figure out how to do it in the sprites unity animation engine.
2. I would like to trigger a standing up animation before the character begins to walk away from his sitting down position. Can’t figure out where to do that.

Thanks in advance

Comments

  • I think Chris will be able to advise you more thoroughly, but:

    1. I don't think you can do that using the Sprites Unity animation engine. If you change over to the Sprites Unity Complex engine, then it's really easy. Instead of giving AC the name of a talk animation to play, you give it the name of a boolean parameter in the animation controller. AC will toggle this boolean true or false depending on whether a line is being spoken by the character. Then you just need to use that parameter as a condition to transition from your sitting animation to the sitting_down_talking one.
    2. This depends on how you want it to work mechanically. When the character is sitting down, what sort of input does the player need to enter for the character to get up? If you have locked the character in place, then it's just a matter of hooking an actionlist to a click, and in this actionlist you can (1) play a custom animation for the character to get up, and create a transition from this to the idle one in the controller, and (2) unlock movement. Then the player can click again to move around.

    Another option is not to lock movement at all, and simply create a transition like this: sitting_down_idle>stand_up>walk, where the first transition happens when the character's move speed float is higher than 0. The issue here is that the character is not locked in place, and clicking immediately makes the character pathfind to a different location, so the stand_up animation will play while the character is already moving. To fix this, you can attach this script to the character:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using AC;
    
    public class DelayWalk : MonoBehaviour
    {
        public AC.Char character;
        public void SetSpeed(float newWalkSpeed)
        {
            character.walkSpeedScale = newWalkSpeed;
        }
    }
    

    This will allow you to add an animation event to the beginning of your standing animation to make the walk speed 0, and then add another event to the end of the animation to restore the walk speed to whatever it was before.

    Anyway, in short, you will need to switch to the Sprites Unity Complex engine.

  • Thanks for the thorough response. I was hoping to avoid switching to the complex engine, but I guess I’ll have to. I’ll try it tonight.
  • While Spries Unity Complex is handy for situations like this that involve more involved animation, it shouldn't strictly be necessary.

    When referencing a character that uses Sprites Unity, the Character: Animate Action's Set Standard method can be used to change the name of their idle/walk/talk etc animations. So long as you have an alternative set of animations that match the new naming convention, you can switch to them as the character sits down.

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.