You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-18 14:21:41 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user