如果手柄按钮按下


描述

With this action you can poll the gamepad to see if any button is currently being pressed. The action will return true every step that the gamepad button is being pressed (and held) down, or false otherwise, although if you click the not modifier you can then check to see if the button is not being pressed, ie: the action will return true while no button is pressed and false if there is. If you only need to check for a single button press then use the action if gamepad button down.

注意:如果要将动作添加进 "if" 动作块,它们应该被放置到动作的一边,如下图所示:
如果if的判断结果是 <t0>真</t0>。那么此动作将会马上执行。放在别处的动作将会在此if动作块后执行。


动作语法:

If Gamepad Button Pressed Syntax


参数:

参数 描述
游戏手柄 The gamepad index.
按钮 The name of the button to check.
否定选项(true变为false,反之亦然)


例如:

If Gamepad Button Example
The above action block code polls the button state of gamepad 0 every step and if a button is being held down it checks for the initial button down press. If the check is true on the initial down press, a sound is played, then, while the button is held down, the sprite blending is changed to red. If the button is not being held down, a check is done on the button release to reset the blending colour to white.