Quote:
|
Originally Posted by cabbagekid2
if (p1_y >= 147)
p1_y = ((p1_wheel)*(p1_y - 127)/254) + 127;
|
This is using integer arithmetic. The division by 254 gives an intermediate result of zero, so the final answer is always 127.
You need to either a) force floating point arithmetic by dividing by
254.0, or b) scale the intermediate calculations up by multiplying by a constant (e.g. 256) first and dividing by the same constant just before adding the 127.