Increase/decrease slider

SingleSparqSingleSparq Member Posts: 1,339
edited November -1 in Tech Support
Hi - I have a slider that moves on touch right or left. How can I get it to increase (moving right) or decrease (moving left) an integer attribute with a limit on the plus or minus (say middle was 100 can go max +100 and -100 in left right when moved. Any help is appreciated!

Comments

  • SethsAppsSethsApps Member, PRO Posts: 328
    Make an invisible actor saying that if that slider collides with the invisible actor either increase or decrease the amount.
  • SingleSparqSingleSparq Member Posts: 1,339
    Yes, never thought of that, will try. I thought it might be more a math thing where if movement to the right or is a calculation but I guess there is more than one way to do things. Thanks!
  • SethsAppsSethsApps Member, PRO Posts: 328
    No problem! Always glad to be of help!
  • SingleSparqSingleSparq Member Posts: 1,339
    Hmmm... tried it and it will technically work but it misses the granularity of the integer.

    If you were only going up to 100 in increments of 10 you would need 10 actors to get to the plus 100 and worry about the decrease (going up would increase with each overlap so you would have to make 10 booleans to switch them to "on", then add some timer cause you can't be overlapping for more than a certain time or it will switch to false etc. etc.

    Will keep trying it though.
  • SingleSparqSingleSparq Member Posts: 1,339
    found firemaples' demo - that should do it:
    http://gamesalad.com/game/play/30207

    How does one mark this resolved?
  • YodapolloYodapollo Inactive, Chef Emeritus Posts: 447
    Currently, posts in the tech support category have the ability to marked 'resolved' and 'not resolved'. I went ahead and moved it into that forum and have marked it 'resolved'.

    --Yodapollo
  • JuliusVelcroJuliusVelcro Member Posts: 3
    Random comment! Mexico!
  • SingleSparqSingleSparq Member Posts: 1,339
    Re-dredging this again - the slider works fine, but it only goes from 0 to 1 in .01 increments. What controls this? If I want the slider to control a set parameter up to 100 nothing I change in the setting or my attribute seems to change this - is it the floor( self.Position.X - self.leftLimit )/( self.rightLimit - self.leftLimit ) formula?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I made that slider to adjust the volume, which just goes from [0,1]. To get a different range, you just need to do some math.

    In that example, I have it clamping down to 0 and 1 with Rules, something like: When The musicVolume < 0 change musicvolume to 0, and when musicvolume is > 1 change musicvolume to 1. You will need to delete those two rules if you want a larger range.

    And you can get rid of the 'floor', you don't need it. Unless you want to strip off the decimal.

    So, for example, if you want the range to be [-100,100] change the formula to look like this:

    ((( self.Position.X - self.leftLimit )/( self.rightLimit - self.leftLimit ))*200)-100

    Hope this helps!
    Joe
  • SingleSparqSingleSparq Member Posts: 1,339
    Sounds good! thanks firemaple, shall mark this resolved again.
Sign In or Register to comment.