简体   繁体   English

需要帮助将我的XNA PC游戏转换为Xbox 360

[英]need help converting my XNA PC Game to Xbox 360

Need help, i googled and converted my project file to xbox 360, but i do not know the buttons and stuff.. to make it work on the game pad. 需要帮助,我用谷歌搜索并将我的项目文件转换为xbox 360,但我不知道按钮和内容..使其无法在游戏板上使用。 here is what i done so far 这是我到目前为止所做的

if (isAI)
{

    Ball b = Game1.ball; //this is AI
    if (b.Y > padMiddle)
        moveDown();
    else if ((b.Y + height) < padMiddle)
        moveUp();
}
else
{
    GamePadState currentState = GamePad.GetState(PlayerIndex.One);
    if (mouse.Y < padMiddle)             // I need to replace mouse with xbox360 stuff
        moveUp();
    else if (mouse.Y > padMiddle)
        moveDown();

mouse.y was declared as MouseState mouse = MouseState.GetState(); mouse.y被声明为MouseState mouse = MouseState.GetState(); i need to replace that with xbox 360 buttons can someone help? 我需要将其替换为xbox 360按钮,有人可以帮忙吗?

You were using a click on the paddle's upper region and lower region to determine if it should be moved up and down. 您正在单击桨的上部区域和下部区域,以确定是否应该上下移动它。 That's going to be a fairly difficult thing to translate exactly on the 360. 要在360上准确翻译,这将是一件相当困难的事情。

If you really want to do it the exact same way, please clarify but if you want to translate it into something that makes more sense you're going to want to use the Thumbsticks for determining whether something should move up or down. 如果您确实想以完全相同的方式进行操作,请澄清一下,但是如果您想将其转换为更有意义的内容,则将要使用“指尖”来确定是否应该向上或向下移动。

            if (isAI) {
                Ball b = Game1.ball; //this is AI
                if (b.Y > padMiddle)
                    moveDown();
                else if ((b.Y + height) < padMiddle)
                    moveUp();
            }
            else
            {
                GamePadState currentState = GamePad.GetState(PlayerIndex.One);
                if (currentState.IsButtonDown(Buttons.LeftThumbstickUp)
                {
                    moveUp();
                }
                else if (currentState.IsButtonDown(Buttons.LeftThumbstickDown)
                {
                    moveDown();
                }
            }

In the above code, it's detecting if the player is pushing up or pushing down on the left thumbstick of the Xbox360 controller and then moves the paddle up and down appropriately 在上面的代码中,它正在检测玩家是否在Xbox360控制器的左指上推或推,然后适当地上下移动操纵杆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM