Resizing Actors From a Different Point
ADSentertainment
Member Posts: 397
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:
What I want:
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!
Here's a more visual representation of what exactly I want to be able to do
What I have:
What I want:
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
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 . . .
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.
Link: https://www.mediafire.com/?hj46ka52zaob4ry
https://www.mediafire.com/?mc57orebw6cyg14
Having trouble with your game? Sounds like a personal problem.