remap value

by loucheman
See Code Download Embed
Remap a value from a original range of value to another range of value.

example:
you have a value in a range of 0 to 5 and you want to transpose this value to another range of values 0 -100.

in this case:
if value = 0 return 0
if value = 3 return 60
if value = 5 return 100

another example:
you want to do 2.5D (size change with y position)
you can remap the y position of your sprite to obtain the size of your object
remap "y position" from range -180 to 180 to range 100 to 10

if y position = -180 return 100 (the size)
if y position = 100 return 30
if y position = 180 return 10
use the result to change the size of your sprite !

Created January 24, 2022

Last updated January 27, 2022

Published January 26, 2022