Ui Rebuild and Full Controller Support #59
4 changed files with 19 additions and 5 deletions
|
@ -21,6 +21,11 @@ func load_data():
|
|||
"move_down": KEY_S,
|
||||
"move_right": KEY_D,
|
||||
"attack": "m" + str(MOUSE_BUTTON_LEFT),
|
||||
"move_up_controller": "j" + str(JOY_AXIS_LEFT_Y) + "/-1.00",
|
||||
"move_left_controller": "j" + str(JOY_AXIS_LEFT_X) + "/-1.00",
|
||||
"move_down_controller": "j" + str(JOY_AXIS_LEFT_Y) + "/1.00",
|
||||
"move_right_controller": "j" + str(JOY_AXIS_LEFT_X) + "/1.00",
|
||||
"attack_controller": "b" + str(JOY_BUTTON_A),
|
||||
}
|
||||
save_data()
|
||||
else:
|
||||
|
|
|
@ -9,7 +9,12 @@ extends Node
|
|||
"move_down",
|
||||
"move_left",
|
||||
"move_right",
|
||||
"attack"
|
||||
"attack",
|
||||
"move_up_controller",
|
||||
"move_down_controller",
|
||||
"move_left_controller",
|
||||
"move_right_controller",
|
||||
"attack_controller"
|
||||
]
|
||||
|
||||
const resolutions_dictionary : Dictionary = {
|
||||
|
@ -87,9 +92,11 @@ func set_controls_from_save_file() -> void:
|
|||
control_event = InputEventJoypadButton.new()
|
||||
control_event.button_index = binding
|
||||
"j":
|
||||
binding = int(binding.right(binding.length()-1))
|
||||
binding = binding.right(binding.length()-1)
|
||||
binding = binding.split("/")
|
||||
control_event = InputEventJoypadMotion.new()
|
||||
control_event.axis = binding
|
||||
control_event.axis = int(binding[0])
|
||||
control_event.axis_value = float(binding[1])
|
||||
_:
|
||||
control_event = InputEventKey.new()
|
||||
control_event.set_keycode(binding)
|
||||
|
|
|
@ -9,8 +9,10 @@ func _ready():
|
|||
func display_key ():
|
||||
self.text = "%s" % InputMap.action_get_events(input_action_name)[0].as_text()
|
||||
if self.text.begins_with("Joypad Motion on Axis"):
|
||||
print(self.text)
|
||||
var split_text = self.text.split(" ")
|
||||
self.text = split_text[3] + " " + split_text[4]
|
||||
self.text = "+" if float(split_text[13]) > 0 else "-"
|
||||
self.text += split_text[3] + " " + split_text[4] + " "
|
||||
if self.text.begins_with("Joypad Button"):
|
||||
var split_text = self.text.split(" ")
|
||||
self.text = split_text[1] + " " + split_text[2]
|
||||
|
|
|
@ -59,7 +59,7 @@ func remap_key(event):
|
|||
"InputEventJoypadButton":
|
||||
Save.game_data["%s" % [remap_action]] = "b" + str(event.button_index)
|
||||
"InputEventJoypadMotion":
|
||||
Save.game_data["%s" % [remap_action]] = "j" + str(event.axis)
|
||||
Save.game_data["%s" % [remap_action]] = "j" + str(event.axis) + str("/1.00" if event.axis_value > 0 else "/-1.00")
|
||||
"InputEventMouseButton":
|
||||
Save.game_data["%s" % [remap_action]] = "m" + str(event.button_index)
|
||||
"InputEventKey":
|
||||
|
|
Reference in a new issue