i messed around the code to come up with this easy to understand codes

[color=blue]if (y<-0.5) return y; // change the value to check where to rebounce example y<1.0
else
return 1;[/color]

[s]i finally understand my own codes[/s]

no worries! the original codes [s]was confusing/misleading i think [/s] deeper meaning than i thought