How do I change the size of a sprite gradually ?

0 favourites
  • 6 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • EDIT : Check the message under to understand my new problem, thanks

    Hi ! I'm trying to do a plateform game, but here's my problem :

    Before entering the pyramid (where all the levels will be in, like an intro), the player will be moving from the left to the right of the screen. I want to create a depth perception effect, for example the sprite initial size is 30x30 and as he goes further to the right, he'll end at a 5x5 size.

    Here's a little drawing I did with paint to help you understand (check the attachment ) :

    IMPORTANT DETAILS :

    • If the player goes to the left, he gain size, like he becomes bigger going to the left and smaller to the right
    • If he keeps going to the right, he can't be under X size, I don't want him to disappear (same for the left)
    • The animation must be gradual and smooth, sexier
    • I'll love for ever the person that will help me

    Thanks

  • Actually nevermind, my friend managed to do it

    I've put the how-to-do-it as an attachment

  • You can use linear interpolation functions to change the player's size based on thier X. Have a read up on lerp in the manual.

    Player.Width = lerp(30, 5, Player.X/PyramidX)

    Player.Height = lerp(30, 5, Player.X/PyramidX)

    You can also affect the jump height and walking speed with the same function, to add to the illusion.

  • Oh thank you, I won't say no to more options

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have another problem though, before I did the change-size thing, I could have my mirror effect applied for when the Sprite was going to the left, now it's disabled so no mather what I press, it will always face the right and never turn, got any ideas on how to arrange that ?

  • Up

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