Joystick and Button: Difference between revisions
Refurbish the whole article
RandomName (talk | contribs) (Added script block images) |
-u ndefined- (talk | contribs) (Refurbish the whole article) |
||
Line 1: | Line 1: | ||
The '''Joystick''' and '''Button''' blocks add UI controls to the screen. | |||
They will display only when they are executed. | |||
Several combinations can be used below. | |||
{{Image|Joystick_and_Button_combos.png}} | |||
In a game, there can be only up to 2 joysticks, 4 buttons, or when used in combination, 1 joystick and 2 buttons ''per frame''. | |||
Going above this limit produces an error of "Too many controls!" | |||
= Joystick = | |||
{{Block | {{Block | ||
|title=Joystick | |||
|image=Joystick.png | |image=Joystick.png | ||
|type=s | |type=s | ||
Line 23: | Line 21: | ||
}} | }} | ||
Adds joystick(s) | Adds joystick(s) to the screen. Unlike most of the blocks in Control tab, Joystick doesn't have any {{Port|e|Execution}} output wires (aside from {{Port|e|After}}, of course). | ||
== Notes == | |||
These are the following settings for the script block: | |||
* '''XZ''': Outputs XZ vector values perpendicular to camera direction (while assuming that the screen is always facing straight to a certain axis). | |||
* '''Screen''': Outputs XY vector values regardless of where the camera is facing. | |||
If you use the '''XZ''' option, Joystick may not give the right outputs you need, because it only gives values perpendicular to the where the camera is facing. | |||
The values will seem normal if the camera is facing in Y-axis upwards or downwards, regardless of angle, but if it's facing sidewards or front and backwards it will only output X-axis value if you're looking at Z-axis and vice versa. | |||
= | In this case you could instead use the '''Screen''' option which ignores where the camera is facing. | ||
This will help but also there's still one more problem to solve: it only outputs values upwards and sidewards now! | |||
This vector should now be [[rotate]]d with '''<font color="ffa500">Rotation</font>''' input <code>90, 0, 0</code>. | |||
{{Image|Joystick_solution.png}} | |||
= Button = | |||
{{Block | {{Block | ||
|title=Button | |||
|image=Button.png | |image=Button.png | ||
|type=s | |type=s | ||
Line 57: | Line 53: | ||
Adds button(s) in the screen. | Adds button(s) in the screen. | ||
== | == Notes == | ||
* Button: | |||
These are the settings for the following script block: | |||
* '''Button''': displays the button as a circular button | |||
* '''Direction''': displays the button as a directional arrow | |||
Depending on the number of buttons set to '''Direction''', they will display the following in left-to-right order: | |||
* '''1 button''': {{Arrow|8}}. | |||
* '''2 buttons''': {{Arrow|4}}, {{Arrow|6}}. | |||
* '''3 buttons''': {{Arrow|4}}, {{Arrow|6}}, {{Arrow|8}}. | |||
* '''4 buttons''': {{Arrow|4}}, {{Arrow|6}}, {{Arrow|2}}, {{Arrow|8}}. | |||
In total with the circular '''Button''' settings, UI is displayed in this manner: | |||
* '''1 button''': right side. | |||
* '''2 buttons''': both sides, with any Button set to Direction substituting the left first, unless a Joystick control exists, in which case the right will be substituted first. | |||
* '''3 buttons''': similar to previous, but the slide to split the buttons depends on how many current Direction buttons are set: 2 and more will split the left, lesser will split the right. Regardless, directional button replacement occurs in left-to-right order. | |||
* '''4 buttons''': spread equally, with directional buttons taking the place of first, second, fourth, and third column sequentially. | |||
[[Category:Blocks]] | [[Category:Blocks]] |