Use StringName literals with Input methods

This commit is contained in:
Aaron Franke
2022-03-27 19:19:09 -05:00
parent ab0816a44e
commit cb52878006
37 changed files with 126 additions and 126 deletions

View File

@@ -105,7 +105,7 @@ func _ready():
func _process(_delta):
if not Engine.is_editor_hint():
if Input.is_action_just_pressed("ui_accept"):
if Input.is_action_just_pressed(&"ui_accept"):
await _reset_test(false)

View File

@@ -17,7 +17,7 @@ func _ready():
func _process(_delta):
if Input.is_action_just_pressed("restart_test"):
if Input.is_action_just_pressed(&"restart_test"):
if _current_test:
_start_test(_current_test)

View File

@@ -27,12 +27,12 @@ func _physics_process(_delta):
_velocity.x = 0.0
# Handle horizontal controls.
if Input.is_action_pressed("character_left"):
if Input.is_action_pressed(&"character_left"):
if position.x > 0.0:
_velocity.x = -_motion_speed
_keep_velocity = false
_constant_velocity = Vector2.ZERO
elif Input.is_action_pressed("character_right"):
elif Input.is_action_pressed(&"character_right"):
if position.x < 1024.0:
_velocity.x = _motion_speed
_keep_velocity = false
@@ -40,7 +40,7 @@ func _physics_process(_delta):
# Handle jump controls and gravity.
if is_on_floor():
if not _jumping and Input.is_action_just_pressed("character_jump"):
if not _jumping and Input.is_action_just_pressed(&"character_jump"):
# Start jumping.
_jumping = true
_velocity.y = -_jump_force

View File

@@ -27,12 +27,12 @@ func _physics_process(_delta):
_velocity.x = 0.0
# Handle horizontal controls.
if Input.is_action_pressed("character_left"):
if Input.is_action_pressed(&"character_left"):
if position.x > 0.0:
_velocity.x = -_motion_speed
_keep_velocity = false
_constant_velocity = Vector2.ZERO
elif Input.is_action_pressed("character_right"):
elif Input.is_action_pressed(&"character_right"):
if position.x < 1024.0:
_velocity.x = _motion_speed
_keep_velocity = false
@@ -40,7 +40,7 @@ func _physics_process(_delta):
# Handle jump controls and gravity.
if is_on_floor():
if not _jumping and Input.is_action_just_pressed("character_jump"):
if not _jumping and Input.is_action_just_pressed(&"character_jump"):
# Start jumping.
_jumping = true
_velocity.y = -_jump_force

View File

@@ -25,13 +25,13 @@ func _enter_tree():
func _process(_delta):
if Input.is_action_just_pressed("toggle_full_screen"):
if Input.is_action_just_pressed(&"toggle_full_screen"):
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
if Input.is_action_just_pressed("toggle_debug_collision"):
if Input.is_action_just_pressed(&"toggle_debug_collision"):
var debug_collision_enabled = not _is_debug_collision_enabled()
_set_debug_collision_enabled(debug_collision_enabled)
if debug_collision_enabled:
@@ -39,10 +39,10 @@ func _process(_delta):
else:
Log.print_log("Debug Collision OFF")
if Input.is_action_just_pressed("toggle_pause"):
if Input.is_action_just_pressed(&"toggle_pause"):
get_tree().paused = not get_tree().paused
if Input.is_action_just_pressed("exit"):
if Input.is_action_just_pressed(&"exit"):
get_tree().quit()