c# - Comparing int's and Vector2's -
i'm trying compare int vector2 position in if statement in code, error: operator '<=' can not applied operands of type 'microsoft.xna.framework.vector2' , 'int'.
here code snippet:
(int = 0; < position.count(); i++) if (position[i] < positiontracker) { mspeed.x = wizardspeed; mdirection.x = move_left; }
as error says there no comparison defined between vector , numeric value. options:
- compare 1 of components of vector:
position[i].x < positiontracker
- compare absolute value of vector numeric value:
position[i].length < positiontracker
Comments
Post a Comment