Forum begins after the advertisement:


[General] How to change main character

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [General] How to change main character

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #13709
    Anuk Thotawatta
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    I used the sprite given in the link in the description to see if the basic mechanics work. now i made a new sprite combining body parts and animating them. I gave it the player controller script and gave the same attributes to it and animated it. But when i insert it to the scene it appears behind everything and is unresponsive. (There are no error messages).

    View post on imgur.com
    #13710
    Anuk Thotawatta
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    Update: it is responsive but it still appears invisible(its sorting layer is the same as the players). And its pivot point is misplaced as seen in the video below.

    #13711
    Anuk Thotawatta
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    Why are my video clips invisible?

    #13712
    Anuk Thotawatta
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    Update 2: the body parts were on the default layer even though the parent object was in midground, that’s why it appeared invisible. And I cant move my characters pivot point because it doesn’t have an avatar for the sprite renderer as it is not a single sprite. What can i do to fix this

    #13713
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    Anuk, your clips are invisible because you just need to paste the Imgur URL like so:

    https://imgur.com/a/H2YBe8G

    But you put them in IMG tags, which doesn’t work:

    <img src="https://imgur.com/a/H2YBe8G"/>

    As for the Sprite Sheet pivot points, you should be able to change the pivot point for each sprite in the Sprite Editor: https://discussions.unity.com/t/how-do-i-change-multiple-pivot-points-in-the-sprite-editor/119405

    #13715
    Joseph Tang
    Level 13
    Moderator
    Helpful?
    Up
    0
    ::

    To add on, I think an easier solution to change all the pivot point of your character to the center is to:

    1. Select all your character’s body parts.
    2. Right-click and “Create Empty Parent”. This parent should have naturally been created in the center point of your selected body parts.
    3. If your empty parent is under another parent object, set it’s Transform Position values to (0, 0, 0).
    #13724
    Anuk Thotawatta
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    Thanks alot. worked out first try

    #13725
    Anuk Thotawatta
    Level 4
    Participant
    Helpful?
    Up
    0
    ::
    View post on imgur.com

    this is a minor problem but i want to make my character a bit bigger but after i resize the body parts and move after i run the game, the sprite gets squished sideways

    #13727
    Joseph Tang
    Level 13
    Moderator
    Helpful?
    Up
    0
    ::

    The reason for the squish is due to the movement code for the Player. We set the X Scale to [1] and [-1] to flip the player every time they change directions.

    But this should be no issue if you did this:

    1. Make sure that the assigned Player (Your PlayerController.cs) is an Empty Parent [Parent 1].
    2. Place your Character’s sprite under a separate Parent [Parent 2], which is under Parent 1.
    3. Change the Scale of Parent 2 to the size that you wish.

    The order should be [Parent 1] > [Parent 2] > [Character sprites]

    Where Parent 1 is your Script and assigned Player & Parent 2 is the center pivot for your Player. Do tell me if this works, since I have not tested this method, purely theory.

    #13730
    Anuk Thotawatta
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    worked out. thanks.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: