Question

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. :)

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top