1. joystick [index] [dir]shaken?

Joystick - 图1

Determines whether the specified joystick is pushed in the specified direction

How to Use

A joystick can be used to control the moving direction of an object.
The number in this block indicates the place of a joystick among the ones connected to Halocode. As shown in the following
figure, the number 1 indicates the first joystick connected to Halocode, 2 indicates the second one, and so on.

Joystick - 图2

The following figure shows the directions and value ranges of the joystick.

Joystick - 图3

Note: This is a Boolean block that contains a condition. Use it in combination with another block that requires a condition.

Example

Joystick - 图4

After you press the space key, the LED matrix displays the image “↑” if you push the joystick upward.
Note: Ensure that you have connected an LED matrix to Halocode.


2. joystick [index] [axis] value

Joystick - 图5

Reports the position value of the specified joystick on the specified axis

How to Use

The following figure shows the x and y axes of the joystick and the value ranges.
Joystick - 图6

You can select the check box on the left of this block to see the position value of the joystick on the x or y axis on the stage.
Note: This is a reporter block that must be used in combination with another block requiring data.

Example

Joystick - 图7

After you press the space key, the LED matrix displays the position value of the joystick on the y axis.
Note: Ensure that you have connected an LED matrix to Halocode.