diff --git a/locales/en.po b/locales/en.po index 7aaf9b6..1f01158 100644 --- a/locales/en.po +++ b/locales/en.po @@ -301,3 +301,27 @@ msgstr "Reverse vertical" msgid "NO_MOUSE_BUTTON" msgstr "Nothing" + +msgid "INPUT_VIEW_CAMERA_LEFT_JOYPAD" +msgstr "Camera Left (Joypad)" + +msgid "INPUT_VIEW_CAMERA_RIGHT_JOYPAD" +msgstr "Camera Right (Joypad)" + +msgid "INPUT_VIEW_CAMERA_FORWARD_JOYPAD" +msgstr "camera Up (Joypad)" + +msgid "INPUT_VIEW_CAMERA_BACK_JOYPAD" +msgstr "Camera Down (Joypad)" + +msgid "INPUT_ACTION_PLAYER_LEFT_JOYPAD" +msgstr "Move Left (Joypad)" + +msgid "INPUT_ACTION_PLAYER_RIGHT_JOYPAD" +msgstr "Move Right (Joypad)" + +msgid "INPUT_ACTION_PLAYER_FORWARD_JOYPAD" +msgstr "Move Up (Joypad)" + +msgid "INPUT_ACTION_PLAYER_BACK_JOYPAD" +msgstr "Move Down (Joypad)" diff --git a/locales/fr.po b/locales/fr.po index 57a6a18..3ba85c0 100644 --- a/locales/fr.po +++ b/locales/fr.po @@ -301,3 +301,27 @@ msgstr "Inversé verticale" msgid "NO_MOUSE_BUTTON" msgstr "Rien n'est sélectionné" + +msgid "INPUT_VIEW_CAMERA_LEFT_JOYPAD" +msgstr "Caméra à gauche (Manette)" + +msgid "INPUT_VIEW_CAMERA_RIGHT_JOYPAD" +msgstr "Caméra à droite (Manette)" + +msgid "INPUT_VIEW_CAMERA_FORWARD_JOYPAD" +msgstr "Caméra en haut (Manette)" + +msgid "INPUT_VIEW_CAMERA_BACK_JOYPAD" +msgstr "Caméra en bas (Manette)" + +msgid "INPUT_ACTION_PLAYER_LEFT_JOYPAD" +msgstr "Déplacer à gauche (Manette)" + +msgid "INPUT_ACTION_PLAYER_RIGHT_JOYPAD" +msgstr "Déplacer à droite (Manette)" + +msgid "INPUT_ACTION_PLAYER_FORWARD_JOYPAD" +msgstr "Déplacer en haut (Manette)" + +msgid "INPUT_ACTION_PLAYER_BACK_JOYPAD" +msgstr "Déplacer en bas (Manette)" diff --git a/locales/messages.mo b/locales/messages.mo index 57be303..2b2166a 100644 Binary files a/locales/messages.mo and b/locales/messages.mo differ diff --git a/locales/messages.pot b/locales/messages.pot index 34baf9b..c09205a 100644 --- a/locales/messages.pot +++ b/locales/messages.pot @@ -293,5 +293,39 @@ msgstr "" msgid "NO_MOUSE_BUTTON" msgstr "" +msgid "INPUT_VIEW_CAMERA_LEFT_JOYPAD" +msgstr "" +msgid "INPUT_VIEW_CAMERA_RIGHT_JOYPAD" +msgstr "" + +msgid "INPUT_VIEW_CAMERA_FORWARD_JOYPAD" +msgstr "" + +msgid "INPUT_VIEW_CAMERA_BACK_JOYPAD" +msgstr "" + +msgid "INPUT_ACTION_PLAYER_LEFT_JOYPAD" +msgstr "" + +msgid "INPUT_ACTION_PLAYER_RIGHT_JOYPAD" +msgstr "" + +msgid "INPUT_ACTION_PLAYER_FORWARD_JOYPAD" +msgstr "" + +msgid "INPUT_ACTION_PLAYER_BACK_JOYPAD" +msgstr "" + +msgid "FACTOR_CAMERA_HORIZONTALE_JOYPAD" +msgstr "" + +msgid "FACTOR_CAMERA_VERTICALE_JOYPAD" +msgstr "" + +msgid "FACTOR_PLAYER_HORIZONTALE_JOYPAD" +msgstr "" + +msgid "FACTOR_PLAYER_VERTICALE_JOYPAD" +msgstr "" diff --git a/player/player.gd b/player/player.gd index ea06679..1ba8929 100644 --- a/player/player.gd +++ b/player/player.gd @@ -793,6 +793,15 @@ func rotate_camera_y(angle_y): detect_camera_collision_y(-angle_y) +func rotate_player(angle_x, angle_y): + player_rotate_y += angle_y + if player_rotate_y > PI: + player_rotate_y -= TAU + elif player_rotate_y <= -PI: + player_rotate_y += TAU + rotate_y( -angle_y ) + + func move_camera(angle_x, angle_y): var new_camera_rotate_x = camera_rotate_x + angle_x if angle_x != 0.0 and new_camera_rotate_x <= PI_2 and new_camera_rotate_x >= - PI_2: @@ -943,7 +952,10 @@ func _process( delta ): # Joypad if tps: var move_camera:Vector2 = Input.get_vector("INPUT_VIEW_CAMERA_LEFT_JOYPAD", "INPUT_VIEW_CAMERA_RIGHT_JOYPAD", "INPUT_VIEW_CAMERA_FORWARD_JOYPAD", "INPUT_VIEW_CAMERA_BACK_JOYPAD") - move_camera(move_camera.y * 0.04, move_camera.x * 0.04) + move_camera(move_camera.y * Common.get_factor_camera_verticale_joypad() * delta, move_camera.x * Common.get_factor_camera_horizontale_joypad() * delta) + var player_joypad:Vector2 = Input.get_vector("INPUT_ACTION_PLAYER_LEFT_JOYPAD", "INPUT_ACTION_PLAYER_RIGHT_JOYPAD", "INPUT_ACTION_PLAYER_FORWARD_JOYPAD", "INPUT_ACTION_PLAYER_BACK_JOYPAD") + #rotate_player(player_joypad.y * Common.get_factor_player_verticale_joypad() * delta, player_joypad.x * Common.get_factor_player_horizontale_joypad() * delta) + y += player_joypad.x * Common.get_factor_player_verticale_joypad() if offset_camera_current != offset_camera_target: var offset_diff = move_camera_y_one_step( offset_camera_target - offset_camera_current, MOVE_CAMERA_Y_OFFSET) diff --git a/scenes/controls/controls.gd b/scenes/controls/controls.gd index 3a47fad..2c8b66d 100644 --- a/scenes/controls/controls.gd +++ b/scenes/controls/controls.gd @@ -158,6 +158,14 @@ func update_joypad_motion(): $Window/v/Tab/JOYPAD/v/PlayerRight/h1/PlayerRight.set_text(Common.get_input_plus("INPUT_ACTION_PLAYER_RIGHT_JOYPAD")) $Window/v/Tab/JOYPAD/v/PlayerForward/h1/PlayerForward.set_text(Common.get_input_plus("INPUT_ACTION_PLAYER_FORWARD_JOYPAD")) $Window/v/Tab/JOYPAD/v/PlayerBack/h1/PlayerBack.set_text(Common.get_input_plus("INPUT_ACTION_PLAYER_BACK_JOYPAD")) + $Window/v/Tab/JOYPAD/v/FactorCameraHorizontale/FactorCameraHorizontale.set_value(Common.get_factor_camera_horizontale_joypad()) + $Window/v/Tab/JOYPAD/v/FactorCameraHorizontale/value.set_text(str(Common.get_factor_camera_horizontale_joypad())) + $Window/v/Tab/JOYPAD/v/FactorCameraVerticale/FactorCameraVerticale.set_value(Common.get_factor_camera_verticale_joypad()) + $Window/v/Tab/JOYPAD/v/FactorCameraVerticale/value.set_text(str(Common.get_factor_camera_verticale_joypad())) + $Window/v/Tab/JOYPAD/v/FactorPlayerHorizontale/FactorPlayerHorizontale.set_value(Common.get_factor_player_horizontale_joypad()) + $Window/v/Tab/JOYPAD/v/FactorPlayerHorizontale/value.set_text(str(Common.get_factor_player_horizontale_joypad())) + $Window/v/Tab/JOYPAD/v/FactorPlayerVerticale/FactorPlayerVerticale.set_value(Common.get_factor_player_verticale_joypad()) + $Window/v/Tab/JOYPAD/v/FactorPlayerVerticale/value.set_text(str(Common.get_factor_player_verticale_joypad())) func configure_control(): @@ -502,3 +510,23 @@ func _on_camera_player_move_reverse_horizontal_toggled(button_pressed): func _on_camera_player_move_reverse_vertical_toggled(button_pressed): Common.set_mouse_camera_player_move_reverse_vertical(button_pressed) + + +func _on_factor_camera_horizontale_value_changed(value): + $Window/v/Tab/JOYPAD/v/FactorCameraHorizontale/value.set_text(str(value)) + Common.set_factor_camera_horizontale_joypad(value) + + +func _on_factor_camera_verticale_value_changed(value): + $Window/v/Tab/JOYPAD/v/FactorCameraVerticale/value.set_text(str(value)) + Common.set_factor_camera_verticale_joypad(value) + + +func _on_factor_player_horizontale_value_changed(value): + $Window/v/Tab/JOYPAD/v/FactorPlayerHorizontale/value.set_text(str(value)) + Common.set_factor_player_horizontale_joypad(value) + + +func _on_factor_player_verticale_value_changed(value): + $Window/v/Tab/JOYPAD/v/FactorPlayerVerticale/value.set_text(str(value)) + Common.set_factor_player_verticale_joypad(value) diff --git a/scenes/controls/controls.tscn b/scenes/controls/controls.tscn index 69d1723..a2a0a60 100644 --- a/scenes/controls/controls.tscn +++ b/scenes/controls/controls.tscn @@ -244,8 +244,8 @@ offset_right = 40.0 offset_bottom = 40.0 [node name="v" type="VBoxContainer" parent="Window/v/Tab/JOYPAD"] -offset_right = 318.0 -offset_bottom = 572.0 +offset_right = 384.0 +offset_bottom = 724.0 size_flags_horizontal = 3 size_flags_vertical = 3 @@ -303,6 +303,32 @@ text = "SELECT" offset_right = 40.0 offset_bottom = 4.0 +[node name="FactorCameraHorizontale" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v"] +offset_right = 384.0 +offset_bottom = 40.0 + +[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/FactorCameraHorizontale"] +offset_right = 40.0 +offset_bottom = 23.0 +size_flags_horizontal = 3 +text = "FACTOR_CAMERA_HORIZONTALE_JOYPAD" + +[node name="FactorCameraHorizontale" type="HSlider" parent="Window/v/Tab/JOYPAD/v/FactorCameraHorizontale"] +offset_right = 8.0 +offset_bottom = 16.0 +size_flags_horizontal = 3 +max_value = 10.0 +step = 0.1 + +[node name="value" type="Label" parent="Window/v/Tab/JOYPAD/v/FactorCameraHorizontale"] +minimum_size = Vector2(50, 0) +offset_right = 40.0 +offset_bottom = 23.0 + +[node name="HSeparator3" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +offset_right = 40.0 +offset_bottom = 4.0 + [node name="CameraForward" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"] offset_right = 40.0 offset_bottom = 40.0 @@ -326,7 +352,7 @@ offset_right = 8.0 offset_bottom = 31.0 text = "SELECT" -[node name="HSeparator3" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +[node name="HSeparator4" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] offset_right = 40.0 offset_bottom = 4.0 @@ -353,7 +379,33 @@ offset_right = 8.0 offset_bottom = 31.0 text = "SELECT" -[node name="HSeparator4" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +[node name="HSeparator5" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +offset_right = 40.0 +offset_bottom = 4.0 + +[node name="FactorCameraVerticale" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v"] +offset_right = 354.0 +offset_bottom = 40.0 + +[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/FactorCameraVerticale"] +offset_right = 40.0 +offset_bottom = 23.0 +size_flags_horizontal = 3 +text = "FACTOR_CAMERA_VERTICALE_JOYPAD" + +[node name="FactorCameraVerticale" type="HSlider" parent="Window/v/Tab/JOYPAD/v/FactorCameraVerticale"] +offset_right = 8.0 +offset_bottom = 16.0 +size_flags_horizontal = 3 +max_value = 10.0 +step = 0.1 + +[node name="value" type="Label" parent="Window/v/Tab/JOYPAD/v/FactorCameraVerticale"] +minimum_size = Vector2(50, 0) +offset_right = 40.0 +offset_bottom = 23.0 + +[node name="HSeparator6" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] offset_right = 40.0 offset_bottom = 4.0 @@ -380,7 +432,7 @@ offset_right = 8.0 offset_bottom = 31.0 text = "SELECT" -[node name="HSeparator5" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +[node name="HSeparator7" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] offset_right = 40.0 offset_bottom = 4.0 @@ -407,13 +459,39 @@ offset_right = 8.0 offset_bottom = 31.0 text = "SELECT" -[node name="HSeparator6" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +[node name="HSeparator8" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +offset_right = 40.0 +offset_bottom = 4.0 + +[node name="FactorPlayerHorizontale" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v"] +offset_right = 384.0 +offset_bottom = 40.0 + +[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/FactorPlayerHorizontale"] +offset_right = 40.0 +offset_bottom = 23.0 +size_flags_horizontal = 3 +text = "FACTOR_PLAYER_HORIZONTALE_JOYPAD" + +[node name="FactorPlayerHorizontale" type="HSlider" parent="Window/v/Tab/JOYPAD/v/FactorPlayerHorizontale"] +offset_right = 8.0 +offset_bottom = 16.0 +size_flags_horizontal = 3 +max_value = 10.0 +step = 0.1 + +[node name="value" type="Label" parent="Window/v/Tab/JOYPAD/v/FactorPlayerHorizontale"] +minimum_size = Vector2(50, 0) +offset_right = 40.0 +offset_bottom = 23.0 + +[node name="HSeparator9" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] offset_right = 40.0 offset_bottom = 4.0 [node name="PlayerForward" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"] -offset_right = 40.0 -offset_bottom = 40.0 +offset_right = 332.0 +offset_bottom = 61.0 [node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerForward"] offset_right = 40.0 @@ -434,13 +512,13 @@ offset_right = 8.0 offset_bottom = 31.0 text = "SELECT" -[node name="HSeparator7" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +[node name="HSeparator10" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] offset_right = 40.0 offset_bottom = 4.0 [node name="PlayerBack" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"] -offset_right = 40.0 -offset_bottom = 40.0 +offset_right = 294.0 +offset_bottom = 61.0 [node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerBack"] offset_right = 40.0 @@ -461,6 +539,32 @@ offset_right = 8.0 offset_bottom = 31.0 text = "SELECT" +[node name="HSeparator11" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] +offset_right = 40.0 +offset_bottom = 4.0 + +[node name="FactorPlayerVerticale" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v"] +offset_right = 354.0 +offset_bottom = 40.0 + +[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/FactorPlayerVerticale"] +offset_right = 40.0 +offset_bottom = 23.0 +size_flags_horizontal = 3 +text = "FACTOR_PLAYER_VERTICALE_JOYPAD" + +[node name="FactorPlayerVerticale" type="HSlider" parent="Window/v/Tab/JOYPAD/v/FactorPlayerVerticale"] +offset_right = 8.0 +offset_bottom = 16.0 +size_flags_horizontal = 3 +max_value = 10.0 +step = 0.1 + +[node name="value" type="Label" parent="Window/v/Tab/JOYPAD/v/FactorPlayerVerticale"] +minimum_size = Vector2(50, 0) +offset_right = 40.0 +offset_bottom = 23.0 + [node name="Quit" type="Button" parent="Window/v"] anchor_left = 0.5 anchor_top = 1.0 @@ -497,10 +601,14 @@ metadata/_edit_use_custom_anchors = false [connection signal="toggled" from="Window/v/Tab/MOUSE/v/CameraPlayerMove/h2/ReverseVertical" to="." method="_on_camera_player_move_reverse_vertical_toggled"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraLeft/h1/CameraLeft" to="." method="_on_camera_left_pressed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraRight/h1/CameraRight" to="." method="_on_camera_right_pressed"] +[connection signal="value_changed" from="Window/v/Tab/JOYPAD/v/FactorCameraHorizontale/FactorCameraHorizontale" to="." method="_on_factor_camera_horizontale_value_changed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraForward/h1/CameraForward" to="." method="_on_camera_forward_pressed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraBack/h1/CameraBack" to="." method="_on_camera_back_pressed"] +[connection signal="value_changed" from="Window/v/Tab/JOYPAD/v/FactorCameraVerticale/FactorCameraVerticale" to="." method="_on_factor_camera_verticale_value_changed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/PlayerLeft/h1/PlayerLeft" to="." method="_on_player_left_pressed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/PlayerRight/h1/PlayerRight" to="." method="_on_player_right_pressed"] +[connection signal="value_changed" from="Window/v/Tab/JOYPAD/v/FactorPlayerHorizontale/FactorPlayerHorizontale" to="." method="_on_factor_player_horizontale_value_changed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/PlayerForward/h1/PlayerForward" to="." method="_on_player_forward_pressed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/PlayerBack/h1/PlayerBack" to="." method="_on_player_back_pressed"] +[connection signal="value_changed" from="Window/v/Tab/JOYPAD/v/FactorPlayerVerticale/FactorPlayerVerticale" to="." method="_on_factor_player_verticale_value_changed"] [connection signal="pressed" from="Window/v/Quit" to="." method="_on_quit_pressed"] diff --git a/scripts/common.gd b/scripts/common.gd index e46366b..3e1e99b 100644 --- a/scripts/common.gd +++ b/scripts/common.gd @@ -10,6 +10,11 @@ var mouse_camera_only_reverse_vertical:bool = false var mouse_camera_player_move_reverse_horizontal:bool = false var mouse_camera_player_move_reverse_vertical:bool = false +var factor_camera_horizontale_joypad:float = 2.0 +var factor_camera_verticale_joypad:float = 2.0 +var factor_player_horizontale_joypad:float = 2.0 +var factor_player_verticale_joypad:float = 2.0 + func _ready(): randomize() @@ -291,3 +296,35 @@ func get_mul_mouse_camera_player_move_reverse_vertical() -> float: return -1.0 else: return 1.0 + + +func set_factor_camera_horizontale_joypad(value:float): + factor_camera_horizontale_joypad = value + + +func get_factor_camera_horizontale_joypad() -> float: + return factor_camera_horizontale_joypad + + +func set_factor_camera_verticale_joypad(value:float): + factor_camera_verticale_joypad = value + + +func get_factor_camera_verticale_joypad() -> float: + return factor_camera_verticale_joypad + + +func set_factor_player_horizontale_joypad(value:float): + factor_player_horizontale_joypad = value + + +func get_factor_player_horizontale_joypad() -> float: + return factor_player_horizontale_joypad + + +func set_factor_player_verticale_joypad(value:float): + factor_player_verticale_joypad = value + + +func get_factor_player_verticale_joypad() -> float: + return factor_player_verticale_joypad