Scale/Resize independent of origin?

0 favourites
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • I have my play animations all with their origin set to centre, is there a way of scaling the height of an object without it using the origin as the scale point? I can't change the origin to the bottom where it needs to be for the height resize to look right, so can I make C2 resize the height as if the origin is at the bottom?

  • You could use the math here:

  • You could use the math here:

    If I use the math there in the scale expression, won't it still scale to the origin, as C2 does that by default, doesn't it? Or does this need to go somewhere else?

  • Try it. The math will make it scale from (centerx, centery) regardless where the origin on the sprite is.

  • Try it. The math will make it scale from (centerx, centery) regardless where the origin on the sprite is.

    So, do I need to make centerY and centerX globals? What numbers should I set them to?

  • You could also create a second image point and use that as the reference when you're scaling.

    Or if you didn't want to deal with creating a second image point, and want to scale from the center bottom, you could scale from sprite.x, sprite.y+sprite.height/2.

  • You could also create a second image point and use that as the reference when you're scaling.

    How do you do this? I can make image points, I just have no idea how to reference it with scaling?

  • Using the expressions:

    Sprite.ImagePointX(point)

    Sprite.ImagePointY(point)

    Replace "point" with either the index of the of the image point like 0 for the origin, 1 for the first image point, 2 for the second,... and so on.

    ...or you can use the name of the image point.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Using the expressions:

    Sprite.ImagePointX(point)

    Sprite.ImagePointY(point)

    Replace "point" with either the index of the of the image point like 0 for the origin, 1 for the first image point, 2 for the second,... and so on.

    ...or you can use the name of the image point.

    So, for instance, if I want to squash a sprite's height, do I use that in the set height expression?

  • Only "scale" is used in the set height expression. It's actually the same as if you squished the height with it scaled around the origin. The only thing that changes when you scale from a different point is the object needs to be moved.

  • Only "scale" is used in the set height expression. It's actually the same as if you squished the height with it scaled around the origin. The only thing that changes when you scale from a different point is the object needs to be moved.

    Right, so which action do I need to use to be able to "squash" a sprite from an image point rather than it's origin?

  • The actions are a set position and set size action using the equations I linked to. I'll have to defer to someone else for further discussion or perhaps alternate solutions.

  • The actions are a set position and set size action using the equations I linked to. I'll have to defer to someone else for further discussion or perhaps alternate solutions.

    Sorry R0J0hound I'm trying not to be stupid, I just couldn't quite work out where to put those equations!

  • I'm probably just explaining it poorly. Here's an example of it if it helps.

    https://dl.dropboxusercontent.com/u/542 ... ottom.capx

  • I'm probably just explaining it poorly. Here's an example of it if it helps.

    https://dl.dropboxusercontent.com/u/542 ... ottom.capx

    Thanks for the example! Now, can an object have it's position manipulated if it's being pinned? <img src="{SMILIES_PATH}/icon_e_geek.gif" alt=":geek:" title="Geek">

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)