小编Muf*_*fin的帖子

Buggy IF声明

我有一个错误的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)

c# testing if-statement xna-4.0 operand

1
推荐指数
1
解决办法
76
查看次数

> =操作数不能应用于Bool和Float类型

我有这个长篇大论.它给了我错误

>= 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)

谁能告诉我修复是什么?谢谢.:)

c# boolean operand

-5
推荐指数
1
解决办法
478
查看次数

标签 统计

c# ×2

operand ×2

boolean ×1

if-statement ×1

testing ×1

xna-4.0 ×1