1

For example my health number is 50.

and i need to use slider to add or minus the health.

but my edit slider number is 0 - 15

so how can i add or minus the health number through slider number?

when i slider right (0 to 15) , health number add the slider end number. if i slide to 10 is 50 + 10

and slider left (15 to 0),health number return, and 0 is no change.

  • You should find a way to determine the direction of the swipe – fatdrogen Feb 18 '23 at 12:05
  • In general: https://stackoverflow.com/questions/5731863/mapping-a-numeric-range-onto-another .. in your case since both ranges align on the minimum `0` you can simply do `valueA / maxA * maxB` to map from the range A `(0, maxA)` onto the range B `(0, maxB)` .. be aware of integer division ;) – derHugo Feb 19 '23 at 19:59

0 Answers0