-5

I have this long if statement. Its giving me the error

>= Operand cannot be applied to types Bool and Float

if (tl.State == TouchLocationState.Pressed && 
    (tl.Position.X >= harePlayer.Position.X >= tl.Position.X && 
     tl.Position.Y >= harePlayer.Position.Y &&
     harePlayer.Position.X <= (harePlayer.Position.X + 52) &&
     tl.Position.Y <= (harePlayer.Position.Y + 50)))

Could anyone tell me what the fix is? Thank you. :)

Charles
  • 50,943
  • 13
  • 104
  • 142
Muffin
  • 33
  • 6
  • Unrelated, but `harePlayer.Position.X <= (harePlayer.Position.X + 52)` is always true unless harePlayer.Position.X is NaN. – Kyle Jan 18 '14 at 20:47

1 Answers1

8

tl.Position.X >= harePlayer.Position.X >= tl.Position.X is not correct c# condition. You have to write two separate conditions and merge them using &&:

tl.Position.X >= harePlayer.Position.X && harePlayer.Position.X >= tl.Position.X
MarcinJuraszek
  • 124,003
  • 15
  • 196
  • 263