diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2015-12-09 08:38:23 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2015-12-09 08:38:23 +0100 |
commit | 8639cecf4cedd56452b47503be19c44b304cd02f (patch) | |
tree | e2a795da15e40c7d9d5b82e33378f8dbf0eaf67a /demos/gui/input_mapping | |
parent | efbb834936fdc9da9789ad37c9cc61e0b90cda95 (diff) |
Improve code formatting and update to 2.0
The scripts were streamlined using more or less the following conventions:
- space after a comma in lists of arguments
- space around weak operators (+, -), no space around strong operators (*, /)
- space after a comment start (#)
- removed trailing spaces or tabs, apart from those that delimit the function indentation level (those could be removed too but since they are added automatically by the editor when typing code, keeping them for now)
- function blocks separate by two newlines
The scene files were resaved with the (current) 2.0 format, and some scenes that were in XML format were converted to SCN, to be consistent across all demos.
Diffstat (limited to 'demos/gui/input_mapping')
-rw-r--r-- | demos/gui/input_mapping/controls.gd | 4 | ||||
-rw-r--r-- | demos/gui/input_mapping/controls.scn | bin | 2852 -> 2698 bytes |
2 files changed, 4 insertions, 0 deletions
diff --git a/demos/gui/input_mapping/controls.gd b/demos/gui/input_mapping/controls.gd index 6ca059c812..7420053ef1 100644 --- a/demos/gui/input_mapping/controls.gd +++ b/demos/gui/input_mapping/controls.gd @@ -11,10 +11,12 @@ extends Control +# member variables var player_actions = [ "move_up", "move_down", "move_left", "move_right", "jump" ] var action # To register the action the UI is currently handling var button # Button node corresponding to the above action + func wait_for_input(action_bind): action = action_bind # See note at the beginning of the script @@ -22,6 +24,7 @@ func wait_for_input(action_bind): get_node("contextual_help").set_text("Press a key to assign to the '" + action + "' action.") set_process_input(true) + func _input(event): # Handle the first pressed key if (event.type == InputEvent.KEY): @@ -39,6 +42,7 @@ func _input(event): # Add the new key binding InputMap.action_add_event(action, event) + func _ready(): # Initialise each button with the default key binding from InputMap var input_event diff --git a/demos/gui/input_mapping/controls.scn b/demos/gui/input_mapping/controls.scn Binary files differindex 03567fb691..98cbbca464 100644 --- a/demos/gui/input_mapping/controls.scn +++ b/demos/gui/input_mapping/controls.scn |