Frage

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

War es hilfreich?

Lösung

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top