欢迎光临散文网 会员登陆 & 注册

注意,这是一条编程求助视频!!!急需大佬们帮忙

2023-07-03 11:44 作者:梅弟meide  | 我要投稿

以下是我写的代码逻辑, X轴y轴就是移动的gUI的位置,isfollowing是用来确定x轴移动方向的,比如x轴是每帧+3或-3

if (this.x轴 >= (float)(Screen.width / 2 - 250) && this.x轴 <= (float)(Screen.width / 2 - 250 + 500) && this.y轴 >= 0f && this.y轴 <= (float)(Screen.height / 2 - 150))

{

this.x上 = true;

}

else

{

this.x上 = false;

}

if (this.x轴 >= (float)(Screen.width / 2 - 250) && this.x轴 <= (float)(Screen.width / 2 - 250 + 500) && this.y轴 >= (float)(Screen.height / 2 - 150 + 330) && this.y轴 <= (float)Screen.height)

{

this.x下 = true;

}

else

{

this.x下 = false;

}

if (this.y轴 >= (float)(Screen.height / 2 - 150) && this.y轴 <= (float)(Screen.height / 2 - 150 + 330) && this.x轴 >= 0f && this.x轴 <= (float)(Screen.width / 2 - 250))

{

this.y左 = true;

}

else

{

this.y左 = false;

}

if (this.y轴 >= (float)(Screen.height / 2 - 150) && this.y轴 <= (float)(Screen.height / 2 - 150 + 330) && this.x轴 >= (float)(Screen.width / 2 - 250 + 500) && this.x轴 <= (float)Screen.width)

{

this.y右 = true;

}

else

{

this.y右 = false;

}

if (!this.isfollowing && !this.ismoving)

{

this.x轴 += 3f;

}

if (this.isfollowing && !this.ismoving)

{

this.x轴 -= 3f;

}

if (this.x轴 > (float)(Screen.width / 2 - 250) && this.y左)

{

this.isfollowing = true;

}

if (this.x轴 < (float)(Screen.width / 2 - 250 + 500) && this.y右)

{

this.isfollowing = false;

}

if (this.x轴 > (float)Screen.width)

{

this.isfollowing = true;

}

if (this.x轴 <= 0f)

{

this.isfollowing = false;

}

if (!this.yisfollowing && !this.ismoving)

{

this.y轴 += 3f;

}

if (this.yisfollowing && !this.ismoving)

{

this.y轴 -= 3f;

}

if (this.y轴 > (float)(Screen.height / 2 - 150) && this.x上)

{

this.yisfollowing = true;

}

if (this.y轴 < (float)(Screen.height / 2 - 150 + 330) && this.x下)

{

this.yisfollowing = false;

}

if (this.y轴 >= (float)Screen.height)

{

this.yisfollowing = true;

}

if (this.y轴 <= 0f)

{

this.yisfollowing = false;

}

注意,这是一条编程求助视频!!!急需大佬们帮忙的评论 (共 条)

分享到微博请遵守国家法律