How do I change sprite size based on position?

1 favourites
  • 6 posts
From the Asset Store
220 Food Sprites in 16x16 pixel size. Perfect for items for a retro style game.
  • capx:

    I'm trying to put together a 2D horror / adventure game.

    The background is something simple I threw together in Photoshop.

    I'd like the player to increase / decrease in size ever so slightly as they move up & down to simulate fake depth.

    I'm not quite sure how, though. Can someone help me out please?

    You could just have the standard "PlayerBox" change size; I imagine adding player sprites on with the same events wouldn't be that hard.

  • on up set size or set height, width

    on down set size or set height, width

  • Thanks for the response, but there's no "on up" or "on down" here.

    This is all I have:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • they are actions of the event.

    and you need to add controls or event that moves the object.

  • I appreciate that, but it's not telling me anything.

  • You could start with something like this:

    Set scale to self.y

    But that makes the scaling ridiculous. So we can reduce the effect

    Set scale to self.y/500

    That's better in that size difference from the top to the bottom is less drastic. But it's still not perfect since it's too small. You can fix that with an offset:

    Set scale to self.y/500 +1

    Now you can fine tune it by tweaking the values till you get a result you like.

    Another way to do it would be to make the formula From two different scales at two different ys. Then just use some algebra to make an exact equation. You could also use lerp here as well.

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