Invalid operands 'float' and 'int' in operator '%'.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By EtheraelEspeon

Why is

if(round($Player.position.x) % disp_W == 0 || round($Player.position.y) % disp_H == 0):

giving me an Invalid operands ‘float’ and ‘int’ in operator ‘%’. error?

disp_W and disp_H are just equal to my display width and height.

:bust_in_silhouette: Reply From: rakkarage

% is mod (modulo) for ints
fmod is mod (modulo) for floats
so cast float to int or use fmod