How do I scale a sprite with slider bar

0 favourites
  • 10 posts
From the Asset Store
slide the tiles to fill the board.60 awesome levels.
  • Hi!

    I'd like to be able to scale a sprite with the help of a slider bar. I was thinking I could check if the slider is incrementing or decrementing in value, but there is no options to check that as far as I know. Do any one have any good suggestions?

    Thanks!

  • Hi!

    I'd like to be able to scale a sprite with the help of a slider bar. I was thinking I could check if the slider is incrementing or decrementing in value, but there is no options to check that as far as I know. Do any one have any good suggestions?

    Thanks!

    Will this help?

    https://www.dropbox.com/s/7pej6heehjs6lo4/spritescalebyslider.capx?dl=0

    I've included a few comments in the .capx.

  • Thank you so much!

    I fiddled with your code a bit, and I wonder how I could make it so it starts at its normal scale at 1 at the farthest right of the slider, and you can only downsize it and bring it up to its normal size again.

    Hope you understand what I mean.

  • Thank you so much!

    I fiddled with your code a bit, and I wonder how I could make it so it starts at its normal scale at 1 at the farthest right of the slider, and you can only downsize it and bring it up to its normal size again.

    Hope you understand what I mean.

    Set the Slider property 'Value' = 100 (i.e. far right maximum)

    Then SliderBar OnChanged - Set sprite.scale = SliderBar.Value/100

    If you want to do away with the '/100' part of the 'SliderBar.Value/100'

    Then you can just set the initial SliderBar proprties to:

    Value =1

    Minimum = 0

    Maximum = 1

    Step = 0.1 (or 0.01 etc for the number of steps between Min and Max you want)

    Then you would just need

    SliderBar OnChanged - Set sprite.scale = SliderBar.Value

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome! Thank you for your time helping me out, works perfectly.

  • Sorry for bumping an old thread, but since I can't send a PM to can you re-upload your example file? It's 404 on me.

  • Sorry for bumping an old thread, but since I can't send a PM to can you re-upload your example file? It's 404 on me.

    Link updated.

    Does it work now?

  • > Sorry for bumping an old thread, but since I can't send a PM to can you re-upload your example file? It's 404 on me.

    >

    Link updated.

    Does it work now?

    Yes, thank you zenox98 ! But I realized that I'm using this at an object which is a plugin, and it doesn't have "Set Scale" function. So I need to achieve this with "Set Width" and "Set Height"... could you help me with this?

  • I don't really understand what you mean by 'using this at an object which is a plugin'. Are you using some other plugin that doesn't come as standard with C2?

    Maybe best if you provide your .capx for us to see what you are referring to, if possible.

  • I don't really understand what you mean by 'using this at an object which is a plugin'. Are you using some other plugin that doesn't come as standard with C2?

    Maybe best if you provide your .capx for us to see what you are referring to, if possible.

    Sorry I can't upload with this capped internet I'm on.. yes it's not a standard C2 object. It has no "set scale" function.

    I'm asking if you can modify your example but with Set Width and Height function to produce similar result.

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