technicaljicama / godot-psp

Godot Engine – Multi-platform 2D and 3D game engine | PSP port
https://godotengine.org
Other
152 stars 1 forks source link

Need help to use InputEventJoystickMotion and InputEventJoystickButton #6

Closed Kystan closed 1 year ago

Kystan commented 1 year ago

Need help to use InputEventJoystickMotion and InputEventJoystickButton

Could you help me understand how to make a dead zone for the PSP stick using these functions. Values must be in the format 0.73657 and 0.57367548 (this is an example)

Here is my code: var joy_axis = Input.get_joy_axis(0, 0) if joy_axis == 0.5: if Input.is_action_pressed("R_Stick"): motion1.x += 1 else: if Input.is_action_pressed("R_Stick"): motion1.x += 0

if joy_axis == LOLdead_zone:
    if Input.is_action_pressed("L_Stick"):
        motion1.x -= 1
else:
    if Input.is_action_pressed("L_Stick"):
        motion1.x -= 0

motion1 = motion1.normalized() * speed
move_and_slide(motion1)

Stick.txt

technicaljicama commented 1 year ago

This is not a psp related issue, I have done analog input by directly mapping joy_axis_0 and joy_axis_1 to x and y

Kystan commented 1 year ago

I understand what it is about, but I do not quite understand how to write it in code. Could you send me your code so I can understand enough? I would be extremely grateful to you for this service.

technicaljicama commented 1 year ago

I'll send you one soon

technicaljicama commented 1 year ago

Input.get_joy_axis(0, JOY_ANALOG_0_X) Input.get_joy_axis(0, JOY_ANALOG_0_Y) Input.get_joy_axis(0, JOY_ANALOG_1_X) Input.get_joy_axis(0, JOY_ANALOG_1_Y)

this is how to get all 4 values from the left stick