Fixed.
Develop games in your browser. Powerful, performant & highly capable.
I can't open the capx right now but maybe it's because you use int() instead of float() so the result is being rounded?