mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
Use StringName literals with Input methods
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user