User Tools

Site Tools


en:tutorials:8way_joystick_control

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:tutorials:8way_joystick_control [2018/02/17 12:33 (10 months ago)]
sausage created
en:tutorials:8way_joystick_control [2018/09/22 15:00 (3 months ago)] (current)
sausage
Line 9: Line 9:
 {{section>​en:​orx:​config:​settings_main:​input_joystick#​[joystick_half-axes]&​noheader&​nofooter&​noeditbutton}} {{section>​en:​orx:​config:​settings_main:​input_joystick#​[joystick_half-axes]&​noheader&​nofooter&​noeditbutton}}
  
-When pushing the stick in a direction, after getting past the threshold, the push will be "​ON"​. Before the threshold, it will be off, emulating a digital joystick or gamepad direction inputs (d-pad).+When pushing the stick in a direction, after getting past the [[en:​tutorials:​analog_stick_threshold|threshold]], the push will be "​ON"​. Before the threshold, it will be off, emulating a digital joystick or gamepad direction inputs (d-pad).
  
 Let's work through setting this up. Firstly, ''​init''​ up a new project using [[en:​tutorials:​creating_your_own_project|these instructions]]. Let's work through setting this up. Firstly, ''​init''​ up a new project using [[en:​tutorials:​creating_your_own_project|these instructions]].
Line 47: Line 47:
  
 [MainInput] [MainInput]
-+JOY_X_1 ​  = GoRight ++JOY_LX_1 ​  = GoRight 
--JOY_X_1 ​  = GoLeft +-JOY_LX_1 ​  = GoLeft 
-+JOY_Y_1 ​  = GoUp ++JOY_LY_1 ​  = GoUp 
--JOY_Y_1 ​  = GoDown+-JOY_LY_1 ​  = GoDown
 KEY_ESCAPE = Quit KEY_ESCAPE = Quit
 </​code>​ </​code>​
  
-The ''​+JOY_X_1''​ above means, if the analog stick is pushed along the X axis, in the positive direction, and after it has crossed the threshold, which is half the entire distance the stick can move (0.5), register a ''​GoRight''​ button press.+The ''​+JOY_LX_1''​ above means, if the left analog stick is pushed along the X axis, in the positive direction, and after it has crossed the [[en:​tutorials:​analog_stick_threshold|threshold]], which is half the entire distance the stick can move (0.5), register a ''​GoRight''​ button press.
  
-In the same way, the ''​-JOY_Y_1''​ means the if the Y axis has been pulled down, passed the halfway (0.5) threshold, register a ''​GoDown''​ press.+In the same way, the ''​-JOY_LY_1''​ means the if the Y axis has been pulled down with the left stickand has passed the halfway (0.5) threshold, register a ''​GoDown''​ press
 + 
 +Visit [[en:​tutorials:​analog_stick_threshold|Analog Stick Threshold]] for more details on thresholds.
  
 Finally in the ''​Run()''​ function, we can add the code to respond to these "​presses"​. ''​Run()''​ is not normally the recommended place to put this code, but for demonstration purposes, it is fine: Finally in the ''​Run()''​ function, we can add the code to respond to these "​presses"​. ''​Run()''​ is not normally the recommended place to put this code, but for demonstration purposes, it is fine:
en/tutorials/8way_joystick_control.1518870828.txt.gz · Last modified: 2018/02/17 12:33 (10 months ago) by sausage