我有一个错误的IF声明.我试图检查触摸是否在某个区域内.然而,它似乎正在为精灵创建一个隐形触摸盒,它是一个永无止境的触摸盒,它正好在屏幕外.左侧和顶部区域工作正常,但右侧的X轴是错误的.这是我的IF声明.
if (tl.State == TouchLocationState.Pressed
&& tl.Position.X >= harePlayer.Position.X
&& tl.Position.Y >= harePlayer.Position.Y
&& harePlayer.Position.X <= (harePlayer.Position.X + 52)
&& tl.Position.Y <= (harePlayer.Position.Y + 50))
Run Code Online (Sandbox Code Playgroud) 我有这个长篇大论.它给了我错误
>= 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)))
Run Code Online (Sandbox Code Playgroud)
谁能告诉我修复是什么?谢谢.:)