Resizing Actors From a Different Point

Is it possible to have an actor increase its size from a different location than instead of the center? I know how to do it with health bars, but that puts the bar at a fixed location, which I don't want since my actor moves.

Here's a more visual representation of what exactly I want to be able to do

What I have:
photo Resize01_zpsf2cbd0e2.gif

What I want:
photo Resize02_zps0c4df2bd.gif

Note that I'm not talking about using the resize behavior, I want to know if you can change the x value, but when the resizing of the actor goes in a single direction.

Thank you!

Having trouble with your game? Sounds like a personal problem.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2014
    @ADSentertainment

    Nice question with the little illustrations ! :)>-

    Think of it like this:

    Your actors starts off in one position with a certain size - then ends up in another position at a different size - so all you have you have to do to achieve this is to interpolate between the two . . .

    Interpolate X position from start position to end position
    Interpolate Y position from start position to end position
    Interpolate Height from start size to end size
    Interpolate Width from start size to end size


    Hold on, I feel a Photoshop sketch coming up . . .



  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2014
    Here you go . .

    Take a look at this illustration, we want the purple box to shrink from its base rather than its centre . . . so . .

    If you were to place the two states (the original state and the target state) next to each other you can clearly see what is involved in this process.

    The purple box needs to shrink vertically, so a simple interpolation from its original height to its target height will do the job.

    And it also needs to move down - in my example 3 and a half blocks (take a look at its centre point), so again a simple interpolation from its original Y position to its target Y position.

    image

  • SocksSocks London, UK.Member Posts: 12,822
  • SocksSocks London, UK.Member Posts: 12,822
    The same demo project - played around with:

    https://www.mediafire.com/?mc57orebw6cyg14
  • ADSentertainmentADSentertainment Member Posts: 397
    @Socks Aaah, alright! That makes sense, very clever! Thanks for being very clear by the way!

    Having trouble with your game? Sounds like a personal problem.

Sign In or Register to comment.