C#位置大于.... [英] C# Location Greater then...................

查看:86
本文介绍了C#位置大于....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

This is my code

if (Death.Location == new Point(Death.Location.X <= 30, Death.Location.Y))
           {
               Death.Location = new Point(Death.Location.X - movement, Death.Location.Y);
           }



这些是我的错误
<pre lang="vb">Error 1 The best overloaded method match for ''System.Drawing.Point.Point(int, int)'' has some invalid arguments C:\Users\Kyle\documents\visual studio 2010\Projects\Game 1\Game 1\Form2.cs 156 39 Game 1</pre>

<pre lang="vb">Error 2 Argument 1: cannot convert from ''bool'' to ''int'' C:\Users\Kyle\documents\visual studio 2010\Projects\Game 1\Game 1\Form2.cs 156 49 Game 1</pre>



these are my errors
<pre lang="vb">Error 1 The best overloaded method match for ''System.Drawing.Point.Point(int, int)'' has some invalid arguments C:\Users\Kyle\documents\visual studio 2010\Projects\Game 1\Game 1\Form2.cs 156 39 Game 1</pre>

<pre lang="vb">Error 2 Argument 1: cannot convert from ''bool'' to ''int'' C:\Users\Kyle\documents\visual studio 2010\Projects\Game 1\Game 1\Form2.cs 156 49 Game 1</pre>

推荐答案

if(Death.Location.X <=30)
{
   //your code goes here
}


这是因为Death.Location.X <= 30是布尔值,但您需要整数.
似乎您不了解自己想要什么.您将Death.LocationDeath.Location进行比较,然后分配Death.Location ...

—SA
This is because Death.Location.X <= 30 is boolean, but you need integer.
It does not seem you understand what do you want. You compare Death.Location with Death.Location and then assign Death.Location

—SA


这篇关于C#位置大于....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆