Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Showing just part of the sprite

Discussion in '2D' started by Kharkand, Feb 9, 2015.

  1. Kharkand

    Kharkand

    Joined:
    Feb 9, 2015
    Posts:
    2
    Hi everyone!

    I have a doubt, I'm trying to make a 2D game and I need a worm to come out from an apple, the problem is that the worm is longer than the apple so I can't hide it behind the apple. Moreover, making a fake background will cause me issues with the other sprites, so I can't use that.

    So, my doubt is if it's possible to show just a part of the sprite, and hide the other part, to make the illusion that the worm is coming out from the inside of the apple.

    Thank you!
     
  2. x3meblue

    x3meblue

    Joined:
    Jan 25, 2014
    Posts:
    2
    Try to use scaling. Set the pivot point at the end of the worm, then slowly increase the scaling in the x-axis so the worm is getting more long in the direction from the tail to the head. Or split the Worm in 2 separate sprites, one is the front with the head, the other the tail. First they overlay each other, then if the worm comes out, the tail is set at the end of the front ( or you could connect them with joints for example).
     
  3. Kharkand

    Kharkand

    Joined:
    Feb 9, 2015
    Posts:
    2
    Thank you for the answer! But modifing the scale the worm lose his shape and it doesn't work well.
    Im trying to split it, but It should be a better solution for my problem.
     
  4. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    897
    Set the sprite to multiple and in the sprite editor make several sprites that overlap. Start with the shortest part of the worm you want to show, and make the next sprite a bit longer. Then either animate the sprites or switch to the next part manually. That ought to be a simple way of doing what you want...
     
    theANMATOR2b likes this.
  5. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Another simple suggestion is to make the 'front' part of the apple a separate piece or duplicate the front part of the apple (up to the point where the worm is coming out of the hole) to cover the back part of the worm.