diff --git a/2d/bullet_shower/bullets.gd b/2d/bullet_shower/bullets.gd
index cca86096..504f3eee 100644
--- a/2d/bullet_shower/bullets.gd
+++ b/2d/bullet_shower/bullets.gd
@@ -17,7 +17,7 @@ var shape := RID()
class Bullet:
var position := Vector2()
var speed := 1.0
- # The body is stored as a RID, which is an "opaque" way to access resources.
+ # The body is stored as an RID, which is an "opaque" way to access resources.
# With large amounts of objects (thousands or more), it can be significantly
# faster to use RIDs compared to a high-level approach.
var body := RID()
@@ -42,9 +42,9 @@ func _ready() -> void:
# Place bullets randomly on the viewport and move bullets outside the
# play area so that they fade in nicely.
bullet.position = Vector2(
- randf_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
- randf_range(0, get_viewport_rect().size.y)
- )
+ randf_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
+ randf_range(0, get_viewport_rect().size.y)
+ )
var transform2d := Transform2D()
transform2d.origin = bullet.position
PhysicsServer2D.body_set_state(bullet.body, PhysicsServer2D.BODY_STATE_TRANSFORM, transform2d)
diff --git a/2d/custom_drawing/animation.gd b/2d/custom_drawing/animation.gd
index 083e9614..ee56a326 100644
--- a/2d/custom_drawing/animation.gd
+++ b/2d/custom_drawing/animation.gd
@@ -40,4 +40,4 @@ func _draw() -> void:
Color.MEDIUM_AQUAMARINE,
line_width_thin,
use_antialiasing
- )
+ )
diff --git a/2d/custom_drawing/animation_slice.gd b/2d/custom_drawing/animation_slice.gd
index d2e6fe75..518800b2 100644
--- a/2d/custom_drawing/animation_slice.gd
+++ b/2d/custom_drawing/animation_slice.gd
@@ -26,11 +26,11 @@ func _draw() -> void:
draw_animation_slice(ANIMATION_LENGTH, slice_begin, slice_end)
draw_set_transform(margin + offset, deg_to_rad(randf_range(-5.0, 5.0)))
draw_rect(
- Rect2(Vector2(), Vector2(100, 50)),
- Color.from_hsv(randf(), 0.4, 1.0),
- true,
- -1.0,
- use_antialiasing
- )
+ Rect2(Vector2(), Vector2(100, 50)),
+ Color.from_hsv(randf(), 0.4, 1.0),
+ true,
+ -1.0,
+ use_antialiasing
+ )
draw_end_animation()
diff --git a/2d/custom_drawing/lines.gd b/2d/custom_drawing/lines.gd
index 80404313..61c81721 100644
--- a/2d/custom_drawing/lines.gd
+++ b/2d/custom_drawing/lines.gd
@@ -50,11 +50,11 @@ func _draw() -> void:
draw_circle(margin + offset, 40 - antialiasing_width_offset * 0.5, Color.ORANGE, true, -1.0, use_antialiasing)
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
- # `_draw()` function after it. This can be used to translate, rotate or scale `draw_` methods
+ # `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_primitive()` not having a position parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
#
- # Draw an horizontally stretched circle.
+ # Draw a horizontally stretched circle.
offset += Vector2(200, 0)
draw_set_transform(margin + offset, 0.0, Vector2(3.0, 1.0))
draw_circle(Vector2(), 40, Color.ORANGE, false, line_width_thin, use_antialiasing)
@@ -82,7 +82,7 @@ func _draw() -> void:
offset += Vector2(100, 0)
draw_arc(margin + offset, 40, -0.25 * TAU, 0.5 * TAU, POINT_COUNT_LOW, Color.YELLOW, 6.0 - antialiasing_width_offset, use_antialiasing)
- # Draw an horizontally stretched arc.
+ # Draw a horizontally stretched arc.
offset += Vector2(200, 0)
draw_set_transform(margin + offset, 0.0, Vector2(3.0, 1.0))
draw_arc(Vector2(), 40, -0.25 * TAU, 0.5 * TAU, POINT_COUNT_LOW, Color.YELLOW, line_width_thin, use_antialiasing)
diff --git a/2d/custom_drawing/meshes.gd b/2d/custom_drawing/meshes.gd
index aaf3bebd..8661f140 100644
--- a/2d/custom_drawing/meshes.gd
+++ b/2d/custom_drawing/meshes.gd
@@ -40,12 +40,13 @@ func _ready() -> void:
multi_mesh.set_instance_color(4, Color(0.7, 1, 1))
multi_mesh.mesh = sphere_mesh
+
func _draw() -> void:
const margin := Vector2(300, 70)
var offset := Vector2()
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
- # `_draw()` function after it. This can be used to translate, rotate or scale `draw_` methods
+ # `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_primitive()` not having a position parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
#
diff --git a/2d/custom_drawing/polygons.gd b/2d/custom_drawing/polygons.gd
index fb769288..b4e50c35 100644
--- a/2d/custom_drawing/polygons.gd
+++ b/2d/custom_drawing/polygons.gd
@@ -20,25 +20,25 @@ func _draw() -> void:
var antialiasing_width_offset := 1.0 if use_antialiasing else 0.0
var points := PackedVector2Array([
- Vector2(0, 0),
- Vector2(0, 60),
- Vector2(60, 90),
- Vector2(60, 0),
- Vector2(40, 25),
- Vector2(10, 40),
- ])
+ Vector2(0, 0),
+ Vector2(0, 60),
+ Vector2(60, 90),
+ Vector2(60, 0),
+ Vector2(40, 25),
+ Vector2(10, 40),
+ ])
var colors := PackedColorArray([
- Color.WHITE,
- Color.RED,
- Color.GREEN,
- Color.BLUE,
- Color.MAGENTA,
- Color.MAGENTA,
- ])
+ Color.WHITE,
+ Color.RED,
+ Color.GREEN,
+ Color.BLUE,
+ Color.MAGENTA,
+ Color.MAGENTA,
+ ])
var offset := Vector2()
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
- # `_draw()` function after it. This can be used to translate, rotate or scale `draw_` methods
+ # `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_primitive()` not having a position parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
draw_set_transform(margin + offset)
@@ -57,7 +57,7 @@ func _draw() -> void:
draw_primitive(points.slice(0, 4), colors.slice(0, 4), PackedVector2Array())
# Draw a polygon with multiple colors that are interpolated between each point.
- # Colors are specified in the same order as points' positions, but in a different array.
+ # Colors are specified in the same order as the points' positions, but in a different array.
offset = Vector2(0, 120)
draw_set_transform(margin + offset)
draw_polygon(points, colors)
diff --git a/2d/custom_drawing/rectangles.gd b/2d/custom_drawing/rectangles.gd
index f808836c..7d9fd59f 100644
--- a/2d/custom_drawing/rectangles.gd
+++ b/2d/custom_drawing/rectangles.gd
@@ -26,7 +26,7 @@ func _draw() -> void:
false,
line_width_thin,
use_antialiasing
- )
+ )
offset += Vector2(120, 0)
draw_rect(
@@ -35,7 +35,7 @@ func _draw() -> void:
false,
2.0 - antialiasing_width_offset,
use_antialiasing
- )
+ )
offset += Vector2(120, 0)
draw_rect(
@@ -44,7 +44,7 @@ func _draw() -> void:
false,
6.0 - antialiasing_width_offset,
use_antialiasing
- )
+ )
# Draw a filled rectangle. The width parameter is ignored for filled rectangles (it's set to `-1.0` to avoid warnings).
# We also reduce the rectangle's size by half the antialiasing width offset.
@@ -56,10 +56,10 @@ func _draw() -> void:
true,
-1.0,
use_antialiasing
- )
+ )
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
- # `_draw()` function after it. This can be used to translate, rotate or scale `draw_` methods
+ # `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_rect()` not having a rotation parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
offset += Vector2(170, 0)
@@ -70,7 +70,7 @@ func _draw() -> void:
false,
line_width_thin,
use_antialiasing
- )
+ )
offset += Vector2(120, 0)
draw_set_transform(margin + offset, deg_to_rad(22.5))
draw_rect(
@@ -79,7 +79,7 @@ func _draw() -> void:
false,
2.0 - antialiasing_width_offset,
use_antialiasing
- )
+ )
offset += Vector2(120, 0)
draw_set_transform(margin + offset, deg_to_rad(22.5))
draw_rect(
@@ -88,7 +88,7 @@ func _draw() -> void:
false,
6.0 - antialiasing_width_offset,
use_antialiasing
- )
+ )
# `draw_set_transform_matrix()` is a more advanced counterpart of `draw_set_transform()`.
# It can be used to apply transforms that are not supported by `draw_set_transform()`, such as
@@ -99,12 +99,12 @@ func _draw() -> void:
custom_transform.y.x -= 0.5
draw_set_transform_matrix(custom_transform)
draw_rect(
- Rect2(Vector2(), Vector2(100, 50)),
- Color.PURPLE,
- false,
- 6.0 - antialiasing_width_offset,
- use_antialiasing
- )
+ Rect2(Vector2(), Vector2(100, 50)),
+ Color.PURPLE,
+ false,
+ 6.0 - antialiasing_width_offset,
+ use_antialiasing
+ )
draw_set_transform(Vector2())
offset = Vector2(0, 250)
diff --git a/2d/custom_drawing/text.gd b/2d/custom_drawing/text.gd
index a6f10b8c..66109f43 100644
--- a/2d/custom_drawing/text.gd
+++ b/2d/custom_drawing/text.gd
@@ -21,16 +21,16 @@ func _draw() -> void:
# Get the glyph index of the character we've just drawn, so we can retrieve the glyph advance.
# This determines the spacing between glyphs so the next character is positioned correctly.
var glyph_idx := TextServerManager.get_primary_interface().font_get_glyph_index(
- get_theme_default_font().get_rids()[0],
- FONT_SIZE,
- character.unicode_at(0),
- 0
- )
+ get_theme_default_font().get_rids()[0],
+ FONT_SIZE,
+ character.unicode_at(0),
+ 0
+ )
advance.x += TextServerManager.get_primary_interface().font_get_glyph_advance(
get_theme_default_font().get_rids()[0],
FONT_SIZE,
glyph_idx
- ).x
+ ).x
offset += Vector2(0, 32)
# When drawing a font outline, it must be drawn *before* the main text.
@@ -44,7 +44,7 @@ func _draw() -> void:
FONT_SIZE,
12,
Color.ORANGE.darkened(0.6)
- )
+ )
# NOTE: Use `draw_multiline_string()` to draw strings that contain line breaks (`\n`) or with
# automatic line wrapping based on the specified width.
# A width of `-1` is used here, which means "no limit". If width is limited, the end of the string
@@ -57,4 +57,4 @@ func _draw() -> void:
-1,
FONT_SIZE,
Color.YELLOW
- )
+ )
diff --git a/2d/custom_drawing/textures.gd b/2d/custom_drawing/textures.gd
index b24d4a5c..6d83e817 100644
--- a/2d/custom_drawing/textures.gd
+++ b/2d/custom_drawing/textures.gd
@@ -13,7 +13,7 @@ func _draw() -> void:
draw_texture(ICON, margin + offset, Color.WHITE)
# `draw_set_transform()` is a stateful command: it affects *all* `draw_` methods within this
- # `_draw()` function after it. This can be used to translate, rotate or scale `draw_` methods
+ # `_draw()` function after it. This can be used to translate, rotate, or scale `draw_` methods
# that don't offer dedicated parameters for this (such as `draw_rect()` not having a rotation parameter).
# To reset back to the initial transform, call `draw_set_transform(Vector2())`.
#
@@ -30,7 +30,7 @@ func _draw() -> void:
Rect2(margin + offset, Vector2(256, 256)),
false,
Color.GREEN
- )
+ )
# Draw a tiled texture. In this example, the icon is 128×128 so it will be drawn twice on each axis.
@@ -40,7 +40,7 @@ func _draw() -> void:
Rect2(margin + offset, Vector2(256, 256)),
true,
Color.GREEN
- )
+ )
offset = Vector2(0, 300)
@@ -49,7 +49,7 @@ func _draw() -> void:
Rect2(margin + offset, Vector2(128, 128)),
Rect2(Vector2(32, 32), Vector2(64, 64)),
Color.VIOLET
- )
+ )
# Draw a tiled texture from a region that is larger than the original texture size (128×128).
# Transposing is enabled, which will rotate the image by 90 degrees counter-clockwise.
@@ -64,4 +64,4 @@ func _draw() -> void:
Rect2(Vector2(), Vector2(512, 512)),
Color.VIOLET,
true
- )
+ )
diff --git a/2d/dodge_the_creeps/main.gd b/2d/dodge_the_creeps/main.gd
index 3e8cf2f8..7333222e 100644
--- a/2d/dodge_the_creeps/main.gd
+++ b/2d/dodge_the_creeps/main.gd
@@ -46,6 +46,7 @@ func _on_MobTimer_timeout():
# Spawn the mob by adding it to the Main scene.
add_child(mob)
+
func _on_ScoreTimer_timeout():
score += 1
$HUD.update_score(score)
diff --git a/2d/finite_state_machine/player/bullet/bullet_spawner.gd b/2d/finite_state_machine/player/bullet/bullet_spawner.gd
index 2f3d063d..e8c4d0b0 100644
--- a/2d/finite_state_machine/player/bullet/bullet_spawner.gd
+++ b/2d/finite_state_machine/player/bullet/bullet_spawner.gd
@@ -3,7 +3,7 @@ extends Node2D
var bullet := preload("Bullet.tscn")
func _unhandled_input(input_event: InputEvent) -> void:
- if input_event.is_action_pressed("fire"):
+ if input_event.is_action_pressed(&"fire"):
fire()
diff --git a/2d/finite_state_machine/player/player_controller.gd b/2d/finite_state_machine/player/player_controller.gd
index 05822099..ba29fc64 100644
--- a/2d/finite_state_machine/player/player_controller.gd
+++ b/2d/finite_state_machine/player/player_controller.gd
@@ -10,6 +10,7 @@ var look_direction := Vector2.RIGHT:
look_direction = value
set_look_direction(value)
+
func take_damage(attacker: Node, amount: float, effect: Node = null) -> void:
if is_ancestor_of(attacker):
return
diff --git a/2d/finite_state_machine/player/player_state_machine.gd b/2d/finite_state_machine/player/player_state_machine.gd
index 39ce4ee1..3d0b7415 100644
--- a/2d/finite_state_machine/player/player_state_machine.gd
+++ b/2d/finite_state_machine/player/player_state_machine.gd
@@ -36,6 +36,7 @@ func _unhandled_input(input_event: InputEvent) -> void:
if input_event.is_action_pressed(PLAYER_STATE.attack):
if current_state in [attack, stagger]:
return
+
_change_state(PLAYER_STATE.attack)
return
diff --git a/2d/finite_state_machine/player/states/motion/motion.gd b/2d/finite_state_machine/player/states/motion/motion.gd
index b6e4dd46..34ae47a0 100644
--- a/2d/finite_state_machine/player/states/motion/motion.gd
+++ b/2d/finite_state_machine/player/states/motion/motion.gd
@@ -2,7 +2,7 @@ extends "res://player/player_state.gd"
# Collection of important methods to handle direction and animation.
func handle_input(input_event: InputEvent) -> void:
- if input_event.is_action_pressed("simulate_damage"):
+ if input_event.is_action_pressed(&"simulate_damage"):
finished.emit(PLAYER_STATE.stagger)
@@ -10,7 +10,7 @@ func get_input_direction() -> Vector2:
return Vector2(
Input.get_axis(&"move_left", &"move_right"),
Input.get_axis(&"move_up", &"move_down")
- )
+ )
func update_look_direction(direction: Vector2) -> void:
diff --git a/2d/finite_state_machine/player/states/motion/on_ground/move.gd b/2d/finite_state_machine/player/states/motion/on_ground/move.gd
index 2c85d017..9470d070 100644
--- a/2d/finite_state_machine/player/states/motion/on_ground/move.gd
+++ b/2d/finite_state_machine/player/states/motion/on_ground/move.gd
@@ -22,7 +22,7 @@ func update(_delta: float) -> void:
finished.emit(PLAYER_STATE.idle)
update_look_direction(input_direction)
- if Input.is_action_pressed("run"):
+ if Input.is_action_pressed(&"run"):
speed = max_run_speed
else:
speed = max_walk_speed
@@ -30,7 +30,7 @@ func update(_delta: float) -> void:
var collision_info := move(speed, input_direction)
if not collision_info:
return
- if speed == max_run_speed and collision_info.collider.is_in_group("environment"):
+ if speed == max_run_speed and collision_info.collider.is_in_group(&"environment"):
return
diff --git a/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd b/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd
index bae36cc6..ea7a985c 100644
--- a/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd
+++ b/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd
@@ -4,6 +4,7 @@ var speed := 0.0
var velocity := Vector2()
func handle_input(input_event: InputEvent) -> void:
- if input_event.is_action_pressed("jump"):
+ if input_event.is_action_pressed(&"jump"):
finished.emit(PLAYER_STATE.jump)
+
return super.handle_input(input_event)
diff --git a/2d/finite_state_machine/player/weapon/sword.gd b/2d/finite_state_machine/player/weapon/sword.gd
index d34b3288..b563e44e 100644
--- a/2d/finite_state_machine/player/weapon/sword.gd
+++ b/2d/finite_state_machine/player/weapon/sword.gd
@@ -39,6 +39,7 @@ var combo := [{
var hit_objects := []
+
func _ready() -> void:
$AnimationPlayer.animation_finished.connect(_on_animation_finished)
body_entered.connect(_on_body_entered)
@@ -63,6 +64,7 @@ func _change_state(new_state: States) -> void:
$AnimationPlayer.play(attack_current["animation"])
visible = true
monitoring = true
+
state = new_state
@@ -71,7 +73,7 @@ func _unhandled_input(input_event: InputEvent) -> void:
return
if attack_input_state != AttackInputStates.LISTENING:
return
- if input_event.is_action_pressed("attack"):
+ if input_event.is_action_pressed(&"attack"):
attack_input_state = AttackInputStates.REGISTERED
@@ -96,7 +98,7 @@ func set_ready_for_next_attack() -> void:
func _on_body_entered(body: Node2D) -> void:
- if not body.has_node("Health"):
+ if not body.has_node(^"Health"):
return
if body.get_rid().get_id() in hit_objects:
return
diff --git a/2d/finite_state_machine/state_machine/state_machine.gd b/2d/finite_state_machine/state_machine/state_machine.gd
index 57b66bd3..d2e0a0cc 100644
--- a/2d/finite_state_machine/state_machine/state_machine.gd
+++ b/2d/finite_state_machine/state_machine/state_machine.gd
@@ -20,6 +20,7 @@ var _active := false:
_active = value
set_active(value)
+
func _enter_tree() -> void:
if start_state.is_empty():
start_state = get_child(0).get_path()
diff --git a/2d/glow/beach_cave.gd b/2d/glow/beach_cave.gd
index a72ab9e9..b277f67f 100644
--- a/2d/glow/beach_cave.gd
+++ b/2d/glow/beach_cave.gd
@@ -10,7 +10,7 @@ func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouseMotion and event.button_mask > 0:
cave.position.x = clampf(cave.position.x + event.screen_relative.x, -CAVE_LIMIT, 0)
- if event.is_action_pressed("toggle_glow_map"):
+ if event.is_action_pressed(&"toggle_glow_map"):
if $WorldEnvironment.environment.glow_map:
$WorldEnvironment.environment.glow_map = null
# Restore glow intensity to its default value
diff --git a/2d/isometric/player/goblin.gd b/2d/isometric/player/goblin.gd
index 6d022b0b..12738512 100644
--- a/2d/isometric/player/goblin.gd
+++ b/2d/isometric/player/goblin.gd
@@ -31,8 +31,8 @@ var anim_directions = {
func _physics_process(_delta):
var motion = Vector2()
- motion.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
- motion.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
+ motion.x = Input.get_action_strength(&"move_right") - Input.get_action_strength(&"move_left")
+ motion.y = Input.get_action_strength(&"move_down") - Input.get_action_strength(&"move_up")
motion.y /= 2
motion = motion.normalized() * MOTION_SPEED
set_velocity(motion)
diff --git a/2d/lights_and_shadows/light_shadows.gd b/2d/lights_and_shadows/light_shadows.gd
index c49caa54..8ad28896 100644
--- a/2d/lights_and_shadows/light_shadows.gd
+++ b/2d/lights_and_shadows/light_shadows.gd
@@ -2,16 +2,16 @@ extends Node2D
func _input(event: InputEvent) -> void:
- if event.is_action_pressed("toggle_directional_light"):
+ if event.is_action_pressed(&"toggle_directional_light"):
$DirectionalLight2D.visible = not $DirectionalLight2D.visible
- if event.is_action_pressed("toggle_point_lights"):
- for point_light in get_tree().get_nodes_in_group("point_light"):
+ if event.is_action_pressed(&"toggle_point_lights"):
+ for point_light in get_tree().get_nodes_in_group(&"point_light"):
point_light.visible = not point_light.visible
- if event.is_action_pressed("cycle_directional_light_shadows_quality"):
+ if event.is_action_pressed(&"cycle_directional_light_shadows_quality"):
$DirectionalLight2D.shadow_filter = wrapi($DirectionalLight2D.shadow_filter + 1, 0, 3)
- if event.is_action_pressed("cycle_point_light_shadows_quality"):
- for point_light in get_tree().get_nodes_in_group("point_light"):
+ if event.is_action_pressed(&"cycle_point_light_shadows_quality"):
+ for point_light in get_tree().get_nodes_in_group(&"point_light"):
point_light.shadow_filter = wrapi(point_light.shadow_filter + 1, 0, 3)
diff --git a/2d/navigation/character.gd b/2d/navigation/character.gd
index b99ea907..75a6e9bd 100644
--- a/2d/navigation/character.gd
+++ b/2d/navigation/character.gd
@@ -15,7 +15,7 @@ func _ready() -> void:
# The "click" event is a custom input action defined in
# Project > Project Settings > Input Map tab.
func _unhandled_input(event: InputEvent) -> void:
- if not event.is_action_pressed("click"):
+ if not event.is_action_pressed(&"click"):
return
set_movement_target(get_global_mouse_position())
diff --git a/2d/navigation_astar/pathfind_astar.gd b/2d/navigation_astar/pathfind_astar.gd
index bfa5f8bd..9da8bd61 100644
--- a/2d/navigation_astar/pathfind_astar.gd
+++ b/2d/navigation_astar/pathfind_astar.gd
@@ -18,7 +18,7 @@ var _path := PackedVector2Array()
func _ready() -> void:
# Region should match the size of the playable area plus one (in tiles).
# In this demo, the playable area is 17×9 tiles, so the rect size is 18×10.
- # Depending on the setup TileMapLayer's get_used_rect() can also be used.
+ # Depending on the setup, TileMapLayer's get_used_rect() can also be used.
_astar.region = Rect2i(0, 0, 18, 10)
_astar.cell_size = CELL_SIZE
_astar.offset = CELL_SIZE * 0.5
diff --git a/2d/navigation_mesh_chunks/navmesh_chhunks_demo_2d.gd b/2d/navigation_mesh_chunks/navmesh_chunks_demo_2d.gd
similarity index 92%
rename from 2d/navigation_mesh_chunks/navmesh_chhunks_demo_2d.gd
rename to 2d/navigation_mesh_chunks/navmesh_chunks_demo_2d.gd
index fceacf45..ad8fa636 100644
--- a/2d/navigation_mesh_chunks/navmesh_chhunks_demo_2d.gd
+++ b/2d/navigation_mesh_chunks/navmesh_chunks_demo_2d.gd
@@ -32,11 +32,11 @@ func _ready() -> void:
# Add an outline to define the traversable surface that the parsed collision shapes can "cut" into.
var traversable_outline: PackedVector2Array = PackedVector2Array([
- Vector2(0.0, 0.0),
- Vector2(1920.0, 0.0),
- Vector2(1920.0, 1080.0),
- Vector2(0.0, 1080.0),
- ])
+ Vector2(0.0, 0.0),
+ Vector2(1920.0, 0.0),
+ Vector2(1920.0, 1080.0),
+ Vector2(0.0, 1080.0),
+ ])
source_geometry.add_traversable_outline(traversable_outline)
create_region_chunks(%ChunksContainer, source_geometry, chunk_size * cell_size, agent_radius)
@@ -49,21 +49,21 @@ static func create_region_chunks(chunks_root_node: Node, p_source_geometry: Navi
# Rasterize bounding box into chunk grid to know range of required chunks.
var start_chunk: Vector2 = floor(
- input_geometry_bounds.position / p_chunk_size
- )
+ input_geometry_bounds.position / p_chunk_size
+ )
var end_chunk: Vector2 = floor(
- (input_geometry_bounds.position + input_geometry_bounds.size)
- / p_chunk_size
- )
+ (input_geometry_bounds.position + input_geometry_bounds.size)
+ / p_chunk_size
+ )
for chunk_y in range(start_chunk.y, end_chunk.y + 1):
for chunk_x in range(start_chunk.x, end_chunk.x + 1):
var chunk_id: Vector2i = Vector2i(chunk_x, chunk_y)
var chunk_bounding_box: Rect2 = Rect2(
- Vector2(chunk_x, chunk_y) * p_chunk_size,
- Vector2(p_chunk_size, p_chunk_size),
- )
+ Vector2(chunk_x, chunk_y) * p_chunk_size,
+ Vector2(p_chunk_size, p_chunk_size),
+ )
# We grow the chunk bounding box to include geometry
# from all the neighbor chunks so edges can align.
# The border size is the same value as our grow amount so
@@ -103,9 +103,9 @@ func _process(_delta: float) -> void:
return
var closest_point_on_navmesh: Vector2 = NavigationServer2D.map_get_closest_point(
- map,
- mouse_cursor_position
- )
+ map,
+ mouse_cursor_position
+ )
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
path_start_position = closest_point_on_navmesh
diff --git a/2d/navigation_mesh_chunks/navmesh_chhunks_demo_2d.gd.uid b/2d/navigation_mesh_chunks/navmesh_chunks_demo_2d.gd.uid
similarity index 100%
rename from 2d/navigation_mesh_chunks/navmesh_chhunks_demo_2d.gd.uid
rename to 2d/navigation_mesh_chunks/navmesh_chunks_demo_2d.gd.uid
diff --git a/2d/navigation_mesh_chunks/navmesh_chhunks_demo_2d.tscn b/2d/navigation_mesh_chunks/navmesh_chunks_demo_2d.tscn
similarity index 97%
rename from 2d/navigation_mesh_chunks/navmesh_chhunks_demo_2d.tscn
rename to 2d/navigation_mesh_chunks/navmesh_chunks_demo_2d.tscn
index 671aa970..6964f14a 100644
--- a/2d/navigation_mesh_chunks/navmesh_chhunks_demo_2d.tscn
+++ b/2d/navigation_mesh_chunks/navmesh_chunks_demo_2d.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b3lu6ldhoxd3w"]
-[ext_resource type="Script" uid="uid://ch8mb4cgm22pr" path="res://navmesh_chhunks_demo_2d.gd" id="1_d68tl"]
+[ext_resource type="Script" uid="uid://ch8mb4cgm22pr" path="res://navmesh_chunks_demo_2d.gd" id="1_d68tl"]
[node name="NavMeshChunksDemo2D" type="Node2D"]
script = ExtResource("1_d68tl")
@@ -73,7 +73,7 @@ layout_mode = 2
[node name="Label" type="Label" parent="CanvasLayer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
-text = "Use cursor button to set path start position"
+text = "Use mouse cursor to set path start position"
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
@@ -87,7 +87,7 @@ color = Color(1, 0, 1, 1)
[node name="Label" type="Label" parent="CanvasLayer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
-text = "Path corridor-funnel"
+text = "Path corridor-funnel"
horizontal_alignment = 1
vertical_alignment = 1
diff --git a/2d/navigation_mesh_chunks/project.godot b/2d/navigation_mesh_chunks/project.godot
index bbf273a6..10849aa6 100644
--- a/2d/navigation_mesh_chunks/project.godot
+++ b/2d/navigation_mesh_chunks/project.godot
@@ -12,7 +12,7 @@ config_version=5
config/name="Navigation Mesh Chunks 2D"
config/tags=PackedStringArray("2d", "ai", "demo", "official")
-run/main_scene="res://navmesh_chhunks_demo_2d.tscn"
+run/main_scene="res://navmesh_chunks_demo_2d.tscn"
config/features=PackedStringArray("4.5", "GL Compatibility")
config/icon="res://icon.webp"
diff --git a/2d/particles/pause.gd b/2d/particles/pause.gd
index 99b65d7f..76432565 100644
--- a/2d/particles/pause.gd
+++ b/2d/particles/pause.gd
@@ -7,32 +7,32 @@ func _ready() -> void:
if RenderingServer.get_current_rendering_method() == "gl_compatibility":
is_compatibility = true
text = "Space: Pause/Resume\nG: Toggle glow\n\n\n"
- get_parent().get_node("UnsupportedLabel").visible = true
+ get_parent().get_node(^"UnsupportedLabel").visible = true
# Increase glow intensity to compensate for lower dynamic range.
- get_node("../..").environment.glow_intensity = 4.0
+ get_node(^"../..").environment.glow_intensity = 4.0
func _input(event: InputEvent) -> void:
- if event.is_action_pressed("toggle_pause"):
+ if event.is_action_pressed(&"toggle_pause"):
get_tree().paused = not get_tree().paused
- if not is_compatibility and event.is_action_pressed("toggle_trails"):
+ if not is_compatibility and event.is_action_pressed(&"toggle_trails"):
# Particles disappear if trail type is changed while paused.
# Prevent changing particle type while paused to avoid confusion.
- for particles in get_tree().get_nodes_in_group("trailable_particles"):
+ for particles in get_tree().get_nodes_in_group(&"trailable_particles"):
particles.trail_enabled = not particles.trail_enabled
- if not is_compatibility and event.is_action_pressed("increase_trail_length"):
+ if not is_compatibility and event.is_action_pressed(&"increase_trail_length"):
# Particles disappear if trail type is changed while paused.
# Prevent changing particle type while paused to avoid confusion.
- for particles in get_tree().get_nodes_in_group("trailable_particles"):
+ for particles in get_tree().get_nodes_in_group(&"trailable_particles"):
particles.trail_lifetime = clampf(particles.trail_lifetime + 0.05, 0.1, 1.0)
- if not is_compatibility and event.is_action_pressed("decrease_trail_length"):
+ if not is_compatibility and event.is_action_pressed(&"decrease_trail_length"):
# Particles disappear if trail type is changed while paused.
# Prevent changing particle type while paused to avoid confusion.
- for particles in get_tree().get_nodes_in_group("trailable_particles"):
+ for particles in get_tree().get_nodes_in_group(&"trailable_particles"):
particles.trail_lifetime = clampf(particles.trail_lifetime - 0.05, 0.1, 1.0)
- if event.is_action_pressed("toggle_glow"):
- get_node("../..").environment.glow_enabled = not get_node("../..").environment.glow_enabled
+ if event.is_action_pressed(&"toggle_glow"):
+ get_node(^"../..").environment.glow_enabled = not get_node(^"../..").environment.glow_enabled
diff --git a/2d/physics_platformer/coin/coin.gd b/2d/physics_platformer/coin/coin.gd
index eb6b861f..5218ad1f 100644
--- a/2d/physics_platformer/coin/coin.gd
+++ b/2d/physics_platformer/coin/coin.gd
@@ -5,4 +5,4 @@ var taken := false
func _on_body_enter(body: Node2D) -> void:
if not taken and body is Player:
- ($AnimationPlayer as AnimationPlayer).play("taken")
+ ($AnimationPlayer as AnimationPlayer).play(&"taken")
diff --git a/2d/physics_platformer/player/bullet.gd b/2d/physics_platformer/player/bullet.gd
index aa954f2b..01408684 100644
--- a/2d/physics_platformer/player/bullet.gd
+++ b/2d/physics_platformer/player/bullet.gd
@@ -11,5 +11,5 @@ func disable() -> void:
if disabled:
return
- ($AnimationPlayer as AnimationPlayer).play("shutdown")
+ ($AnimationPlayer as AnimationPlayer).play(&"shutdown")
disabled = true
diff --git a/2d/physics_tests/test.gd b/2d/physics_tests/test.gd
index f682f9f8..92350606 100644
--- a/2d/physics_tests/test.gd
+++ b/2d/physics_tests/test.gd
@@ -19,8 +19,10 @@ class Circle2D:
func _draw() -> void:
draw_circle(center, radius, color)
+
var _drawn_nodes := []
+
func _enter_tree() -> void:
if not _enable_debug_collision:
get_tree().debug_collisions_hint = false
diff --git a/2d/physics_tests/tests/functional/test_character.gd b/2d/physics_tests/tests/functional/test_character.gd
index 265c139a..94acdaff 100644
--- a/2d/physics_tests/tests/functional/test_character.gd
+++ b/2d/physics_tests/tests/functional/test_character.gd
@@ -81,7 +81,7 @@ func _ready() -> void:
var floor_slider: Control = find_child("FloorMaxAngle")
if floor_slider:
- floor_slider.get_node("HSlider").value = _floor_max_angle
+ floor_slider.get_node(^"HSlider").value = _floor_max_angle
_start_test()
diff --git a/2d/physics_tests/tests/performance/test_perf_broadphase.gd b/2d/physics_tests/tests/performance/test_perf_broadphase.gd
index 3c7d1439..29c07270 100644
--- a/2d/physics_tests/tests/performance/test_perf_broadphase.gd
+++ b/2d/physics_tests/tests/performance/test_perf_broadphase.gd
@@ -146,7 +146,7 @@ func _remove_objects() -> void:
Log.print_log("* Removing objects...")
var timer := Time.get_ticks_usec()
- # Remove objects in reversed order to avoid the overhead of changing children index in parent.
+ # Remove objects in reversed order to avoid the overhead of changing child index in parent.
var object_count := _objects.size()
for object_index in object_count:
root_node.remove_child(_objects[object_count - object_index - 1])
diff --git a/2d/physics_tests/tests/performance/test_perf_contacts.gd b/2d/physics_tests/tests/performance/test_perf_contacts.gd
index c453da34..3d32c775 100644
--- a/2d/physics_tests/tests/performance/test_perf_contacts.gd
+++ b/2d/physics_tests/tests/performance/test_perf_contacts.gd
@@ -199,7 +199,7 @@ func _despawn_objects() -> void:
if object_count == 0:
continue
- # Remove objects in reversed order to avoid the overhead of changing children index in parent.
+ # Remove objects in reversed order to avoid the overhead of changing child index in parent.
for object_index in range(object_count):
var node: Node2D = spawn_parent.get_child(object_count - object_index - 1)
spawn_parent.remove_child(node)
diff --git a/2d/physics_tests/utils/rigidbody_controller.gd b/2d/physics_tests/utils/rigidbody_controller.gd
index ab7c66d0..1b616158 100644
--- a/2d/physics_tests/utils/rigidbody_controller.gd
+++ b/2d/physics_tests/utils/rigidbody_controller.gd
@@ -69,5 +69,6 @@ func _integrate_forces(state: PhysicsDirectBodyState2D) -> void:
_jumping = false
_velocity.y = 0.0
+
func is_on_floor() -> bool:
return _on_floor
diff --git a/2d/platformer/enemy/enemy.gd b/2d/platformer/enemy/enemy.gd
index 969a726a..9257e4a6 100644
--- a/2d/platformer/enemy/enemy.gd
+++ b/2d/platformer/enemy/enemy.gd
@@ -10,7 +10,7 @@ const WALK_SPEED = 22.0
var _state := State.WALKING
-@onready var gravity: int = ProjectSettings.get("physics/2d/default_gravity")
+@onready var gravity: int = ProjectSettings.get(&"physics/2d/default_gravity")
@onready var platform_detector := $PlatformDetector as RayCast2D
@onready var floor_detector_left := $FloorDetectorLeft as RayCast2D
@onready var floor_detector_right := $FloorDetectorRight as RayCast2D
diff --git a/2d/platformer/gui/pause_menu.gd b/2d/platformer/gui/pause_menu.gd
index 2d459e1b..a89c8991 100644
--- a/2d/platformer/gui/pause_menu.gd
+++ b/2d/platformer/gui/pause_menu.gd
@@ -18,17 +18,17 @@ func close() -> void:
var tween := create_tween()
get_tree().paused = false
tween.tween_property(
- self,
- ^"modulate:a",
- 0.0,
- fade_out_duration
- ).set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT)
+ self,
+ ^"modulate:a",
+ 0.0,
+ fade_out_duration
+ ).set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT)
tween.parallel().tween_property(
- center_cont,
- ^"anchor_bottom",
- 0.5,
- fade_out_duration
- ).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_OUT)
+ center_cont,
+ ^"anchor_bottom",
+ 0.5,
+ fade_out_duration
+ ).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_OUT)
tween.tween_callback(hide)
@@ -40,17 +40,17 @@ func open() -> void:
center_cont.anchor_bottom = 0.5
var tween := create_tween()
tween.tween_property(
- self,
- ^"modulate:a",
- 1.0,
- fade_in_duration
- ).set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_IN)
+ self,
+ ^"modulate:a",
+ 1.0,
+ fade_in_duration
+ ).set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_IN)
tween.parallel().tween_property(
- center_cont,
- ^"anchor_bottom",
- 1.0,
- fade_out_duration
- ).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_OUT)
+ center_cont,
+ ^"anchor_bottom",
+ 1.0,
+ fade_out_duration
+ ).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_OUT)
func _on_coin_collected() -> void:
diff --git a/2d/platformer/level/level.gd b/2d/platformer/level/level.gd
index f3203239..a9264944 100644
--- a/2d/platformer/level/level.gd
+++ b/2d/platformer/level/level.gd
@@ -9,7 +9,7 @@ const LIMIT_BOTTOM = 690
func _ready():
for child in get_children():
if child is Player:
- var camera = child.get_node("Camera")
+ var camera = child.get_node(^"Camera")
camera.limit_left = LIMIT_LEFT
camera.limit_top = LIMIT_TOP
camera.limit_right = LIMIT_RIGHT
diff --git a/2d/platformer/player/player.gd b/2d/platformer/player/player.gd
index f241d0ac..3d371874 100644
--- a/2d/platformer/player/player.gd
+++ b/2d/platformer/player/player.gd
@@ -14,7 +14,7 @@ const TERMINAL_VELOCITY = 700
## Used to separate controls for multiple players in splitscreen.
@export var action_suffix := ""
-var gravity: int = ProjectSettings.get("physics/2d/default_gravity")
+var gravity: int = ProjectSettings.get(&"physics/2d/default_gravity")
@onready var platform_detector := $PlatformDetector as RayCast2D
@onready var animation_player := $AnimationPlayer as AnimationPlayer
@onready var shoot_timer := $ShootAnimation as Timer
diff --git a/2d/role_playing_game/combat/combat.gd b/2d/role_playing_game/combat/combat.gd
index 8303261d..20304ec7 100644
--- a/2d/role_playing_game/combat/combat.gd
+++ b/2d/role_playing_game/combat/combat.gd
@@ -19,7 +19,7 @@ func initialize(combat_combatants: Array[PackedScene]) -> void:
var combatant := combatant_scene.instantiate()
if combatant is Combatant:
$Combatants.add_combatant(combatant)
- combatant.get_node("Health").dead.connect(_on_combatant_death.bind(combatant))
+ combatant.get_node(^"Health").dead.connect(_on_combatant_death.bind(combatant))
else:
combatant.queue_free()
ui.initialize()
@@ -30,7 +30,7 @@ func clear_combat() -> void:
for n in $Combatants.get_children():
# Player characters.
n.queue_free()
- for n in ui.get_node("Combatants").get_children():
+ for n in ui.get_node(^"Combatants").get_children():
# Health bars.
n.queue_free()
diff --git a/2d/role_playing_game/combat/combatants/combatant.gd b/2d/role_playing_game/combat/combatants/combatant.gd
index c4db2ec1..a2194cb5 100644
--- a/2d/role_playing_game/combat/combatants/combatant.gd
+++ b/2d/role_playing_game/combat/combatants/combatant.gd
@@ -8,7 +8,7 @@ signal turn_finished
var active := false: set = set_active
-@onready var animation_playback: AnimationNodeStateMachinePlayback = $Sprite2D/AnimationTree.get("parameters/playback")
+@onready var animation_playback: AnimationNodeStateMachinePlayback = $Sprite2D/AnimationTree.get(&"parameters/playback")
func set_active(value: bool) -> void:
active = value
@@ -37,4 +37,4 @@ func flee() -> void:
func take_damage(damage_to_take: float) -> void:
$Health.take_damage(damage_to_take)
- animation_playback.start("take_damage")
+ animation_playback.start(&"take_damage")
diff --git a/2d/role_playing_game/combat/interface/ui.gd b/2d/role_playing_game/combat/interface/ui.gd
index f1388e9b..339f882a 100644
--- a/2d/role_playing_game/combat/interface/ui.gd
+++ b/2d/role_playing_game/combat/interface/ui.gd
@@ -9,12 +9,12 @@ signal flee(winner: Combatant, loser: Combatant)
func initialize() -> void:
for combatant in combatants_node.get_children():
- var health := combatant.get_node("Health")
+ var health := combatant.get_node(^"Health")
var info := info_scene.instantiate()
- var health_info := info.get_node("VBoxContainer/HealthContainer/Health")
+ var health_info := info.get_node(^"VBoxContainer/HealthContainer/Health")
health_info.value = health.life
health_info.max_value = health.max_life
- info.get_node("VBoxContainer/NameContainer/Name").text = combatant.name
+ info.get_node(^"VBoxContainer/NameContainer/Name").text = combatant.name
health.health_changed.connect(health_info.set_value)
$Combatants.add_child(info)
@@ -22,25 +22,25 @@ func initialize() -> void:
func _on_Attack_button_up() -> void:
- if not combatants_node.get_node("Player").active:
+ if not combatants_node.get_node(^"Player").active:
return
- combatants_node.get_node("Player").attack(combatants_node.get_node("Opponent"))
+ combatants_node.get_node(^"Player").attack(combatants_node.get_node(^"Opponent"))
func _on_Defend_button_up() -> void:
- if not combatants_node.get_node("Player").active:
+ if not combatants_node.get_node(^"Player").active:
return
- combatants_node.get_node("Player").defend()
+ combatants_node.get_node(^"Player").defend()
func _on_Flee_button_up() -> void:
- if not combatants_node.get_node("Player").active:
+ if not combatants_node.get_node(^"Player").active:
return
- combatants_node.get_node("Player").flee()
+ combatants_node.get_node(^"Player").flee()
- var loser: Combatant = combatants_node.get_node("Player")
- var winner: Combatant = combatants_node.get_node("Opponent")
+ var loser: Combatant = combatants_node.get_node(^"Player")
+ var winner: Combatant = combatants_node.get_node(^"Opponent")
flee.emit(winner, loser)
diff --git a/2d/role_playing_game/dialogue/interface/interface.gd b/2d/role_playing_game/dialogue/interface/interface.gd
index 65f829fd..9728060c 100644
--- a/2d/role_playing_game/dialogue/interface/interface.gd
+++ b/2d/role_playing_game/dialogue/interface/interface.gd
@@ -11,7 +11,7 @@ func show_dialogue(player: Pawn, dialogue: Node) -> void:
$Button.grab_focus()
dialogue_node = dialogue
- for c in dialogue.get_signal_connection_list("dialogue_started"):
+ for c in dialogue.get_signal_connection_list(&"dialogue_started"):
if player == c.callable.get_object():
dialogue_node.start_dialogue()
$Name.text = "[center]" + dialogue_node.dialogue_name + "[/center]"
diff --git a/2d/role_playing_game/game.gd b/2d/role_playing_game/game.gd
index 770e0692..a682d159 100644
--- a/2d/role_playing_game/game.gd
+++ b/2d/role_playing_game/game.gd
@@ -13,21 +13,21 @@ func _ready() -> void:
for n in $Exploration/Grid.get_children():
if not n.type == n.CellType.ACTOR:
continue
- if not n.has_node("DialoguePlayer"):
+ if not n.has_node(^"DialoguePlayer"):
continue
- n.get_node("DialoguePlayer").dialogue_finished.connect(_on_opponent_dialogue_finished.bind(n))
+ n.get_node(^"DialoguePlayer").dialogue_finished.connect(_on_opponent_dialogue_finished.bind(n))
remove_child(combat_screen)
func start_combat(combat_actors: Array[PackedScene]) -> void:
- $AnimationPlayer.play("fade_to_black")
+ $AnimationPlayer.play(&"fade_to_black")
await $AnimationPlayer.animation_finished
remove_child($Exploration)
add_child(combat_screen)
combat_screen.show()
combat_screen.initialize(combat_actors)
- $AnimationPlayer.play_backwards("fade_to_black")
+ $AnimationPlayer.play_backwards(&"fade_to_black")
func _on_opponent_dialogue_finished(opponent: Pawn) -> void:
@@ -40,7 +40,7 @@ func _on_opponent_dialogue_finished(opponent: Pawn) -> void:
func _on_combat_finished(winner: Combatant, _loser: Combatant) -> void:
remove_child(combat_screen)
- $AnimationPlayer.play_backwards("fade_to_black")
+ $AnimationPlayer.play_backwards(&"fade_to_black")
add_child(exploration_screen)
var dialogue: Node = load("res://dialogue/dialogue_player/dialogue_player.tscn").instantiate()
@@ -51,7 +51,7 @@ func _on_combat_finished(winner: Combatant, _loser: Combatant) -> void:
await $AnimationPlayer.animation_finished
var player: Pawn = $Exploration/Grid/Player
- exploration_screen.get_node("DialogueCanvas/DialogueUI").show_dialogue(player, dialogue)
+ exploration_screen.get_node(^"DialogueCanvas/DialogueUI").show_dialogue(player, dialogue)
combat_screen.clear_combat()
await dialogue.dialogue_finished
dialogue.queue_free()
diff --git a/2d/role_playing_game/grid_movement/grid/grid.gd b/2d/role_playing_game/grid_movement/grid/grid.gd
index 55bb8caa..53f9037c 100644
--- a/2d/role_playing_game/grid_movement/grid/grid.gd
+++ b/2d/role_playing_game/grid_movement/grid/grid.gd
@@ -39,9 +39,9 @@ func request_move(pawn: Pawn, direction: Vector2i) -> Vector2i:
var target_pawn := get_cell_pawn(cell_target, cell_tile_id)
#print("Cell %s contains %s" % [cell_target, target_pawn.name])
- if not target_pawn.has_node("DialoguePlayer"):
+ if not target_pawn.has_node(^"DialoguePlayer"):
return Vector2i.ZERO
- dialogue_ui.show_dialogue(pawn, target_pawn.get_node("DialoguePlayer"))
+ dialogue_ui.show_dialogue(pawn, target_pawn.get_node(^"DialoguePlayer"))
return Vector2i.ZERO
diff --git a/2d/role_playing_game/grid_movement/pawns/player.gd b/2d/role_playing_game/grid_movement/pawns/player.gd
index 282afa05..06f64886 100644
--- a/2d/role_playing_game/grid_movement/pawns/player.gd
+++ b/2d/role_playing_game/grid_movement/pawns/player.gd
@@ -18,4 +18,4 @@ func _process(_delta: float) -> void:
func get_input_direction() -> Vector2:
- return Input.get_vector("move_left", "move_right", "move_up", "move_down")
+ return Input.get_vector(&"move_left", &"move_right", &"move_up", &"move_down")
diff --git a/2d/role_playing_game/grid_movement/pawns/walker.gd b/2d/role_playing_game/grid_movement/pawns/walker.gd
index daa9aaa8..1c45dc26 100644
--- a/2d/role_playing_game/grid_movement/pawns/walker.gd
+++ b/2d/role_playing_game/grid_movement/pawns/walker.gd
@@ -9,8 +9,8 @@ var lost := false
var grid_size: float
@onready var grid : Grid = get_parent()
-@onready var animation_playback: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
-@onready var walk_animation_time: float = $AnimationPlayer.get_animation("walk").length
+@onready var animation_playback: AnimationNodeStateMachinePlayback = $AnimationTree.get(&"parameters/playback")
+@onready var walk_animation_time: float = $AnimationPlayer.get_animation(&"walk").length
@onready var pose := $Pivot/Slime
@@ -27,28 +27,28 @@ func update_look_direction(direction: Vector2) -> void:
func move_to(target_position: Vector2) -> void:
set_process(false)
var move_direction := (target_position - position).normalized()
- pose.play("idle")
- animation_playback.start("walk")
+ pose.play(&"idle")
+ animation_playback.start(&"walk")
var tween := create_tween()
tween.set_ease(Tween.EASE_IN)
var end: Vector2 = $Pivot.position + move_direction * grid_size
- tween.tween_property($Pivot, "position", end, walk_animation_time)
+ tween.tween_property($Pivot, ^"position", end, walk_animation_time)
await tween.finished
$Pivot.position = Vector2.ZERO
position = target_position
- animation_playback.start("idle")
- pose.play("idle")
+ animation_playback.start(&"idle")
+ pose.play(&"idle")
set_process(true)
func bump() -> void:
set_process(false)
- pose.play("bump")
- animation_playback.start("bump")
+ pose.play(&"bump")
+ animation_playback.start(&"bump")
await $AnimationTree.animation_finished
- animation_playback.start("idle")
- pose.play("idle")
+ animation_playback.start(&"idle")
+ pose.play(&"idle")
set_process(true)
diff --git a/2d/skeleton/player/player.gd b/2d/skeleton/player/player.gd
index c8d33def..5bbe8cf6 100644
--- a/2d/skeleton/player/player.gd
+++ b/2d/skeleton/player/player.gd
@@ -31,15 +31,15 @@ func _ready() -> void:
func _physics_process(delta: float) -> void:
var is_jumping := false
- if Input.is_action_just_pressed("jump"):
+ if Input.is_action_just_pressed(&"jump"):
is_jumping = try_jump()
- elif Input.is_action_just_released("jump") and velocity.y < 0.0:
+ elif Input.is_action_just_released(&"jump") and velocity.y < 0.0:
# The player let go of jump early, reduce vertical momentum.
velocity.y *= 0.6
# Fall.
velocity.y = minf(TERMINAL_VELOCITY, velocity.y + gravity * delta)
- var direction := Input.get_axis("move_left", "move_right") * WALK_SPEED
+ var direction := Input.get_axis(&"move_left", &"move_right") * WALK_SPEED
velocity.x = move_toward(velocity.x, direction, ACCELERATION_SPEED * delta)
if no_move_horizontal_time > 0.0:
diff --git a/2d/tween/main.gd b/2d/tween/main.gd
index 622797ac..a652600e 100644
--- a/2d/tween/main.gd
+++ b/2d/tween/main.gd
@@ -68,13 +68,13 @@ func start_animation() -> void:
# Here we are calling a lambda method that creates a sub-Tween.
# Any number of Tweens can animate a single object in the same time.
tween.parallel().tween_callback(func():
- # Note that transition is set on Tween, but ease is set on Tweener.
- # Values set on Tween will affect all Tweeners (as defaults) and values
- # on Tweeners can override them.
- sub_tween = create_tween().set_speed_scale(%SpeedSlider.value).set_trans(Tween.TRANS_SINE)
- sub_tween.tween_property(icon, ^"position:y", -150.0, 0.5).as_relative().set_ease(Tween.EASE_OUT)
- sub_tween.tween_property(icon, ^"position:y", 150.0, 0.5).as_relative().set_ease(Tween.EASE_IN)
- )
+ # Note that transition is set on Tween, but ease is set on Tweener.
+ # Values set on Tween will affect all Tweeners (as defaults) and values
+ # on Tweeners can override them.
+ sub_tween = create_tween().set_speed_scale(%SpeedSlider.value).set_trans(Tween.TRANS_SINE)
+ sub_tween.tween_property(icon, ^"position:y", -150.0, 0.5).as_relative().set_ease(Tween.EASE_OUT)
+ sub_tween.tween_property(icon, ^"position:y", 150.0, 0.5).as_relative().set_ease(Tween.EASE_IN)
+ )
# Step 5
@@ -102,7 +102,7 @@ func start_animation() -> void:
var tweener := tween.tween_method(
func(v: float) -> void:
icon.position = path.position + path.curve.sample_baked(v), 0.0, path.curve.get_baked_length(), 3.0
- ).set_delay(0.5)
+ ).set_delay(0.5)
tweener.set_ease(%Ease7.selected)
tweener.set_trans(%Trans7.selected)
diff --git a/3d/antialiasing/anti_aliasing.gd b/3d/antialiasing/anti_aliasing.gd
index a868ed81..cbd22e6a 100644
--- a/3d/antialiasing/anti_aliasing.gd
+++ b/3d/antialiasing/anti_aliasing.gd
@@ -74,7 +74,7 @@ func _process(delta: float) -> void:
fps_label.text = "%d FPS (%.2f mspf)" % [Engine.get_frames_per_second(), 1000.0 / Engine.get_frames_per_second()]
# Color FPS counter depending on framerate.
# The Gradient resource is stored as metadata within the FPSLabel node (accessible in the inspector).
- fps_label.modulate = fps_label.get_meta("gradient").sample(remap(Engine.get_frames_per_second(), 0, 180, 0.0, 1.0))
+ fps_label.modulate = fps_label.get_meta(&"gradient").sample(remap(Engine.get_frames_per_second(), 0, 180, 0.0, 1.0))
@@ -144,9 +144,9 @@ func _on_fsr_sharpness_item_selected(index: int) -> void:
func _on_viewport_size_changed() -> void:
$ViewportResolution.text = "Viewport resolution: %d×%d" % [
- get_viewport().size.x * get_viewport().scaling_3d_scale,
- get_viewport().size.y * get_viewport().scaling_3d_scale,
- ]
+ get_viewport().size.x * get_viewport().scaling_3d_scale,
+ get_viewport().size.y * get_viewport().scaling_3d_scale,
+ ]
func _on_v_sync_item_selected(index: int) -> void:
diff --git a/3d/decals/tester.gd b/3d/decals/tester.gd
index 37419f39..f594bd89 100644
--- a/3d/decals/tester.gd
+++ b/3d/decals/tester.gd
@@ -36,7 +36,7 @@ func _unhandled_input(event: InputEvent) -> void:
if not result.is_empty():
var decal := preload("res://decal.tscn").instantiate()
add_child(decal)
- decal.get_node("Decal").modulate = Color(1.0,0.0,0)
+ decal.get_node(^"Decal").modulate = Color(1.0,0.0,0)
decal.position = result["position"]
decal.transform.basis = camera.global_transform.basis
diff --git a/3d/global_illumination/README.md b/3d/global_illumination/README.md
index 899a5f1c..0c63f426 100644
--- a/3d/global_illumination/README.md
+++ b/3d/global_illumination/README.md
@@ -1,7 +1,7 @@
# Global Illumination
This demo showcases Godot's global illumination systems:
-LightmapGI, VoxelGI, SDFGI, ReflectionProbe and screen-space effects like SSAO and SSIL.
+LightmapGI, VoxelGI, SDFGI, ReflectionProbe, and screen-space effects like SSAO and SSIL.
Use the mouse to look around, W/A/S/D
or arrow keys to move.
@@ -17,7 +17,7 @@ Check out this demo on the asset library: https://godotengine.org/asset-library/
A sphere and box are parented to the camera to showcase dynamic object lighting.
A ReflectionProbe is parented to the sphere to showcase real-time reflections.
When the ReflectionProbe is hidden, it is disabled. In this case,
-VoxelGI, SDFGI or environment lighting will be used to provide fallback reflections.
+VoxelGI, SDFGI, or environment lighting will be used to provide fallback reflections.
A Decal node is parented to the moving sphere and cube to provide simple shadows for them.
This is especially effective when using the LightmapGI (All) global illumination mode,
diff --git a/3d/global_illumination/camera.gd b/3d/global_illumination/camera.gd
index 259b9f59..a37650d2 100644
--- a/3d/global_illumination/camera.gd
+++ b/3d/global_illumination/camera.gd
@@ -19,7 +19,7 @@ func _input(event: InputEvent) -> void:
rot.x = clamp(rot.x - event.screen_relative.y * MOUSE_SENSITIVITY, -1.57, 1.57)
transform.basis = Basis.from_euler(rot)
- if event.is_action_pressed("toggle_mouse_capture"):
+ if event.is_action_pressed(&"toggle_mouse_capture"):
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
@@ -31,7 +31,7 @@ func _process(delta: float) -> void:
Input.get_axis(&"move_left", &"move_right"),
0,
Input.get_axis(&"move_forward", &"move_back")
- )
+ )
# Normalize motion to prevent diagonal movement from being
# `sqrt(2)` times faster than straight movement.
diff --git a/3d/global_illumination/test.gd b/3d/global_illumination/test.gd
index 24559ee3..0bdf3c56 100644
--- a/3d/global_illumination/test.gd
+++ b/3d/global_illumination/test.gd
@@ -74,7 +74,7 @@ func _ready() -> void:
# Remove unsupported VoxelGI/SDFGI references from the label.
reflection_probe_mode_texts[0] = "Disabled - Using environment reflections (Fast)"
set_gi_mode(GIMode.NONE)
- # Darken lights's energy to compensate for sRGB blending (without affecting sky rendering).
+ # Darken lights' energy to compensate for sRGB blending (without affecting sky rendering).
# This only applies to lights with shadows enabled.
$GrateOmniLight.light_energy = 0.25
$GarageOmniLight.light_energy = 0.5
@@ -94,7 +94,7 @@ Escape or F10: Toggle mouse capture"""
func _input(event: InputEvent) -> void:
- if event.is_action_pressed("cycle_gi_mode"):
+ if event.is_action_pressed(&"cycle_gi_mode"):
if is_compatibility:
# Only LightmapGI is supported in Compatibility.
# Note that the actual GI mode is the opposite of what's being set here, due to a bug
@@ -103,10 +103,10 @@ func _input(event: InputEvent) -> void:
else:
set_gi_mode(wrapi(gi_mode + 1, 0, GIMode.MAX))
- if event.is_action_pressed("cycle_reflection_probe_mode"):
+ if event.is_action_pressed(&"cycle_reflection_probe_mode"):
set_reflection_probe_mode(wrapi(reflection_probe_mode + 1, 0, ReflectionProbeMode.MAX))
- if event.is_action_pressed("cycle_ssil_mode"):
+ if event.is_action_pressed(&"cycle_ssil_mode"):
set_ssil_mode(wrapi(ssil_mode + 1, 0, SSILMode.MAX))
diff --git a/3d/graphics_settings/settings.gd b/3d/graphics_settings/settings.gd
index eaab8ab2..cff0a4a8 100644
--- a/3d/graphics_settings/settings.gd
+++ b/3d/graphics_settings/settings.gd
@@ -35,7 +35,7 @@ func _ready() -> void:
mark_as_unsupported(%SSReflectionsOptionButton)
mark_as_unsupported(%SSILOptionButton)
mark_as_unsupported(%VolumetricFogOptionButton)
- # Darken lights's energy to compensate for sRGB blending (without affecting sky rendering).
+ # Darken lights' energy to compensate for sRGB blending (without affecting sky rendering).
$Node3D/OmniLight3D.light_energy = 0.5
$Node3D/SpotLight3D.light_energy = 0.5
$Node3D/DirectionalLight3D.sky_mode = DirectionalLight3D.SKY_MODE_SKY_ONLY
@@ -59,7 +59,7 @@ func _process(delta: float) -> void:
fps_label.text = "%d FPS (%.2f mspf)" % [Engine.get_frames_per_second(), 1000.0 / Engine.get_frames_per_second()]
# Color FPS counter depending on framerate.
# The Gradient resource is stored as metadata within the FPSLabel node (accessible in the inspector).
- fps_label.modulate = fps_label.get_meta("gradient").sample(remap(Engine.get_frames_per_second(), 0, 180, 0.0, 1.0))
+ fps_label.modulate = fps_label.get_meta(&"gradient").sample(remap(Engine.get_frames_per_second(), 0, 180, 0.0, 1.0))
func update_resolution_label() -> void:
@@ -174,7 +174,7 @@ func _on_fxaa_option_button_item_selected(index: int) -> void:
func _on_fullscreen_option_button_item_selected(index: int) -> void:
- # To change between window, fullscreen and other window modes,
+ # To change between window, fullscreen, and other window modes,
# set the root mode to one of the options of Window.MODE_*.
# Other modes are maximized and minimized.
if index == 0: # Disabled (default)
diff --git a/3d/ik/addons/sade/ik_fabrik.gd b/3d/ik/addons/sade/ik_fabrik.gd
index 250195b8..02125d28 100644
--- a/3d/ik/addons/sade/ik_fabrik.gd
+++ b/3d/ik/addons/sade/ik_fabrik.gd
@@ -23,7 +23,7 @@ const CHAIN_MAX_ITER = 10
var temp = get_node(skeleton_path)
if temp != null:
# If it has the method "get_bone_global_pose" it is likely a Skeleton3D
- if temp.has_method("get_bone_global_pose"):
+ if temp.has_method(&"get_bone_global_pose"):
skeleton = temp
bone_IDs = {}
@@ -109,7 +109,7 @@ func _ready():
if target == null:
# NOTE: You MUST have a node called Target as a child of this node!
# So we create one if one doesn't already exist.
- if not has_node("Target"):
+ if not has_node(^"Target"):
target = Node3D.new()
add_child(target)
@@ -127,7 +127,7 @@ func _ready():
_make_editor_sphere_at_node(target, Color.MAGENTA)
if middle_joint_target == null:
- if not has_node("MiddleJoint"):
+ if not has_node(^"MiddleJoint"):
middle_joint_target = Node3D.new()
add_child(middle_joint_target)
@@ -243,7 +243,7 @@ func solve_chain():
else:
dir = -target.global_transform.basis.z.normalized()
- # Get the target position (accounting for the final bone and it's length)
+ # Get the target position (accounting for the final bone and its length)
var target_pos = target.global_transform.origin + (dir * bones_in_chain_lengths[bone_nodes.size()-1])
# If we are using middle joint target (and have more than 2 bones), move our middle joint towards it!
diff --git a/3d/ik/addons/sade/ik_look_at.gd b/3d/ik/addons/sade/ik_look_at.gd
index 87137ef1..dcc72e77 100644
--- a/3d/ik/addons/sade/ik_look_at.gd
+++ b/3d/ik/addons/sade/ik_look_at.gd
@@ -6,7 +6,7 @@ extends Node3D
# Assign skeleton_path to whatever value is passed.
skeleton_path = value
# Because get_node doesn't work in the first call, we just want to assign instead.
- # This is to get around a issue with NodePaths exposed to the editor.
+ # This is to get around an issue with NodePaths exposed to the editor.
if first_call:
return
_setup_skeleton_path()
@@ -158,9 +158,9 @@ func update_skeleton():
var additional_bone_id = skeleton_to_use.find_bone(additional_bone_name)
var additional_bone_pos = skeleton_to_use.get_bone_global_pose(additional_bone_id)
rest.origin = (
- additional_bone_pos.origin
- - additional_bone_pos.basis.z.normalized() * additional_bone_length
- )
+ additional_bone_pos.origin
+ - additional_bone_pos.basis.z.normalized() * additional_bone_length
+ )
# Finally, apply the new rotation to the bone in the skeleton.
skeleton_to_use.set_bone_global_pose_override(bone, rest, interpolation, true)
diff --git a/3d/ik/fps/example_player.gd b/3d/ik/fps/example_player.gd
index a9d883e3..fafdf4a2 100644
--- a/3d/ik/fps/example_player.gd
+++ b/3d/ik/fps/example_player.gd
@@ -96,10 +96,10 @@ func process_input(delta):
if anim_done:
if current_anim != "Aiming":
- anim_player.play("Aiming")
+ anim_player.play(&"Aiming")
current_anim = "Aiming"
else:
- anim_player.play("Idle")
+ anim_player.play(&"Idle")
current_anim = "Idle"
anim_done = false
diff --git a/3d/ik/target_from_mousepos.gd b/3d/ik/target_from_mousepos.gd
index 04890d53..676b8645 100644
--- a/3d/ik/target_from_mousepos.gd
+++ b/3d/ik/target_from_mousepos.gd
@@ -8,8 +8,8 @@ extends Camera3D
func _process(_delta):
var mouse_to_world = (
- project_local_ray_normal(get_viewport().get_mouse_position()) * MOVEMENT_SPEED
- )
+ project_local_ray_normal(get_viewport().get_mouse_position()) * MOVEMENT_SPEED
+ )
if flip_axis:
mouse_to_world = -mouse_to_world
diff --git a/3d/labels_and_texts/label_3d_layout.gd b/3d/labels_and_texts/label_3d_layout.gd
index 736bab19..11a131ba 100644
--- a/3d/labels_and_texts/label_3d_layout.gd
+++ b/3d/labels_and_texts/label_3d_layout.gd
@@ -54,7 +54,7 @@ func set_health(p_health: int) -> void:
$HealthBarBackground.outline_modulate = Color(0.15, 0.2, 0.15)
$HealthBarBackground.modulate = Color(0.15, 0.2, 0.15)
- # Construct an health bar with `|` symbols brought very close to each other using
+ # Construct a health bar with `|` symbols brought very close to each other using
# a custom FontVariation on the HealthBarForeground and HealthBarBackground nodes.
var bar_text := ""
var bar_text_bg := ""
diff --git a/3d/lights_and_shadows/tester.gd b/3d/lights_and_shadows/tester.gd
index 8c3956b4..409a0452 100644
--- a/3d/lights_and_shadows/tester.gd
+++ b/3d/lights_and_shadows/tester.gd
@@ -74,7 +74,7 @@ func _on_enable_sun_toggled(button_pressed: bool) -> void:
func _on_animate_lights_toggled(button_pressed: bool) -> void:
- for animatable_node in get_tree().get_nodes_in_group("animatable"):
+ for animatable_node in get_tree().get_nodes_in_group(&"animatable"):
animatable_node.set_process(button_pressed)
diff --git a/3d/navigation/character.gd b/3d/navigation/character.gd
index f05e75a4..d80f3212 100644
--- a/3d/navigation/character.gd
+++ b/3d/navigation/character.gd
@@ -40,5 +40,5 @@ func set_target_position(target_position: Vector3) -> void:
start_position,
target_position,
optimize
- )
+ )
_nav_path_line.draw_path(path)
diff --git a/3d/navigation/navmesh.gd b/3d/navigation/navmesh.gd
index 954ef926..f41aecdf 100644
--- a/3d/navigation/navmesh.gd
+++ b/3d/navigation/navmesh.gd
@@ -19,7 +19,7 @@ func _unhandled_input(event: InputEvent) -> void:
get_world_3d().navigation_map,
camera_ray_start,
camera_ray_end
- )
+ )
_robot.set_target_position(closest_point_on_navmesh)
elif event is InputEventMouseMotion:
diff --git a/3d/navigation_mesh_chunks/navmesh_chhunks_demo_3d.gd b/3d/navigation_mesh_chunks/navmesh_chhunks_demo_3d.gd
index ad558a81..0c3d5c38 100644
--- a/3d/navigation_mesh_chunks/navmesh_chhunks_demo_3d.gd
+++ b/3d/navigation_mesh_chunks/navmesh_chhunks_demo_3d.gd
@@ -40,12 +40,12 @@ static func create_region_chunks(chunks_root_node: Node, p_source_geometry: Navi
# Rasterize bounding box into chunk grid to know range of required chunks.
var start_chunk: Vector3 = floor(
- input_geometry_bounds.position / p_chunk_size
- )
+ input_geometry_bounds.position / p_chunk_size
+ )
var end_chunk: Vector3 = floor(
- (input_geometry_bounds.position + input_geometry_bounds.size)
- / p_chunk_size
- )
+ (input_geometry_bounds.position + input_geometry_bounds.size)
+ / p_chunk_size
+ )
# NavigationMesh.border_size is limited to the xz-axis.
# So we can only bake one chunk for the y-axis and also
@@ -61,9 +61,9 @@ static func create_region_chunks(chunks_root_node: Node, p_source_geometry: Navi
var chunk_id: Vector3i = Vector3i(chunk_x, chunk_y, chunk_z)
var chunk_bounding_box: AABB = AABB(
- Vector3(chunk_x, bounds_min_height, chunk_z) * p_chunk_size,
- Vector3(p_chunk_size, bounds_max_height, p_chunk_size),
- )
+ Vector3(chunk_x, bounds_min_height, chunk_z) * p_chunk_size,
+ Vector3(p_chunk_size, bounds_max_height, p_chunk_size),
+ )
# We grow the chunk bounding box to include geometry
# from all the neighbor chunks so edges can align.
# The border size is the same value as our grow amount so
@@ -109,10 +109,10 @@ func _process(_delta: float) -> void:
var camera_ray_start: Vector3 = camera.project_ray_origin(mouse_cursor_position)
var camera_ray_end: Vector3 = camera_ray_start + camera.project_ray_normal(mouse_cursor_position) * camera_ray_length
var closest_point_on_navmesh: Vector3 = NavigationServer3D.map_get_closest_point_to_segment(
- map,
- camera_ray_start,
- camera_ray_end
- )
+ map,
+ camera_ray_start,
+ camera_ray_end
+ )
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
path_start_position = closest_point_on_navmesh
diff --git a/3d/occlusion_culling_mesh_lod/README.md b/3d/occlusion_culling_mesh_lod/README.md
index fa981dd0..d2ef9b42 100644
--- a/3d/occlusion_culling_mesh_lod/README.md
+++ b/3d/occlusion_culling_mesh_lod/README.md
@@ -26,7 +26,7 @@ will vary depending on your CPU and GPU model.
> **Warning**
>
-> If you are using a engine build that is not fully optimized, you may notice
+> If you are using an engine build that is not fully optimized, you may notice
> that enabling occlusion culling decreases performance. This is because
> occlusion culling is a demanding process on the CPU, which needs all the
> build-time optimization it can get.
diff --git a/3d/occlusion_culling_mesh_lod/camera.gd b/3d/occlusion_culling_mesh_lod/camera.gd
index 4792cabf..062e48f9 100644
--- a/3d/occlusion_culling_mesh_lod/camera.gd
+++ b/3d/occlusion_culling_mesh_lod/camera.gd
@@ -19,7 +19,7 @@ func _input(event: InputEvent) -> void:
rot.x = clamp(rot.x - event.screen_relative.y * MOUSE_SENSITIVITY, -1.57, 1.57)
transform.basis = Basis.from_euler(rot)
- if event.is_action_pressed("toggle_mouse_capture"):
+ if event.is_action_pressed(&"toggle_mouse_capture"):
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
@@ -31,7 +31,7 @@ func _process(delta: float) -> void:
Input.get_axis(&"move_left", &"move_right"),
0,
Input.get_axis(&"move_forward", &"move_back")
- )
+ )
# Normalize motion to prevent diagonal movement from being
# `sqrt(2)` times faster than straight movement.
diff --git a/3d/occlusion_culling_mesh_lod/door.gd b/3d/occlusion_culling_mesh_lod/door.gd
index 60cff181..587b9dad 100644
--- a/3d/occlusion_culling_mesh_lod/door.gd
+++ b/3d/occlusion_culling_mesh_lod/door.gd
@@ -3,16 +3,16 @@ extends Node3D
var open := false
func _input(event: InputEvent) -> void:
- if event.is_action_pressed("toggle_doors"):
+ if event.is_action_pressed(&"toggle_doors"):
if open:
# Close the door.
# The occluder will be re-enabled when the animation ends
# using `_on_animation_player_animation_finished()`.
- $AnimationPlayer.play_backwards("open")
+ $AnimationPlayer.play_backwards(&"open")
open = false
else:
# Open the door.
- $AnimationPlayer.play("open")
+ $AnimationPlayer.play(&"open")
open = true
# Disable the occluder as soon as the door starts opening.
# The occluder is not part of the pivot to prevent it from having its
diff --git a/3d/occlusion_culling_mesh_lod/node_3d.gd b/3d/occlusion_culling_mesh_lod/node_3d.gd
index 8b1cb10c..7dac601c 100644
--- a/3d/occlusion_culling_mesh_lod/node_3d.gd
+++ b/3d/occlusion_culling_mesh_lod/node_3d.gd
@@ -1,16 +1,16 @@
extends Node3D
func _input(event: InputEvent) -> void:
- if event.is_action_pressed("toggle_occlusion_culling"):
+ if event.is_action_pressed(&"toggle_occlusion_culling"):
get_viewport().use_occlusion_culling = not get_viewport().use_occlusion_culling
update_labels()
- if event.is_action_pressed("toggle_mesh_lod"):
+ if event.is_action_pressed(&"toggle_mesh_lod"):
get_viewport().mesh_lod_threshold = 1.0 if is_zero_approx(get_viewport().mesh_lod_threshold) else 0.0
update_labels()
- if event.is_action_pressed("cycle_draw_mode"):
+ if event.is_action_pressed(&"cycle_draw_mode"):
get_viewport().debug_draw = wrapi(get_viewport().debug_draw + 1, 0, 5) as Viewport.DebugDraw
update_labels()
- if event.is_action_pressed("toggle_vsync"):
+ if event.is_action_pressed(&"toggle_vsync"):
if DisplayServer.window_get_vsync_mode() == DisplayServer.VSYNC_DISABLED:
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED)
else:
diff --git a/3d/particles/README.md b/3d/particles/README.md
index 7a0ac4ed..e1520055 100644
--- a/3d/particles/README.md
+++ b/3d/particles/README.md
@@ -1,7 +1,7 @@
# 3D Particles
This project showcases various 3D particle features supported by Godot, for both GPU-based and CPU-based particles.
-This includes particle collision, attractors, trails and subemitters.
+This includes particle collision, attractors, trails, and subemitters.
Language: GDScript
diff --git a/3d/physical_light_camera_units/options.gd b/3d/physical_light_camera_units/options.gd
index e03c96d7..2c1fabd1 100644
--- a/3d/physical_light_camera_units/options.gd
+++ b/3d/physical_light_camera_units/options.gd
@@ -17,11 +17,11 @@ func get_color_from_temperature(p_temperature: float) -> Color:
var u := (
(0.860117757 + 1.54118254e-4 * p_temperature + 1.28641212e-7 * t2) /
(1.0 + 8.42420235e-4 * p_temperature + 7.08145163e-7 * t2)
- )
+ )
var v := (
(0.317398726 + 4.22806245e-5 * p_temperature + 4.20481691e-8 * t2) /
(1.0 - 2.89741816e-5 * p_temperature + 1.61456053e-7 * t2)
- )
+ )
# Convert to xyY space.
var d := 1.0 / (2.0 * u - 8.0 * v + 4.0)
@@ -37,7 +37,7 @@ func get_color_from_temperature(p_temperature: float) -> Color:
3.2404542 * xyz.x - 1.5371385 * xyz.y - 0.4985314 * xyz.z,
-0.9692660 * xyz.x + 1.8760108 * xyz.y + 0.0415560 * xyz.z,
0.0556434 * xyz.x - 0.2040259 * xyz.y + 1.0572252 * xyz.z
- )
+ )
linear /= maxf(1e-5, linear[linear.max_axis_index()])
# Normalize, clamp, and convert to sRGB.
return Color(linear.x, linear.y, linear.z).clamp().linear_to_srgb()
@@ -67,7 +67,7 @@ func _on_lightbulb1_intensity_value_changed(value: float) -> void:
func _on_lightbulb1_temperature_value_changed(value: float) -> void:
lightbulb_1.light_temperature = value
$Light/Lightbulb1Temperature/Value.text = "%d K" % value
- $Light/Lightbulb1Temperature/Value.add_theme_color_override("font_color", get_color_from_temperature(value))
+ $Light/Lightbulb1Temperature/Value.add_theme_color_override(&"font_color", get_color_from_temperature(value))
func _on_lightbulb2_intensity_value_changed(value: float) -> void:
@@ -78,7 +78,7 @@ func _on_lightbulb2_intensity_value_changed(value: float) -> void:
func _on_lightbulb2_temperature_value_changed(value: float) -> void:
lightbulb_2.light_temperature = value
$Light/Lightbulb2Temperature/Value.text = "%d K" % value
- $Light/Lightbulb2Temperature/Value.add_theme_color_override("font_color", get_color_from_temperature(value))
+ $Light/Lightbulb2Temperature/Value.add_theme_color_override(&"font_color", get_color_from_temperature(value))
func _on_focus_distance_value_changed(value: float) -> void:
diff --git a/3d/physics_interpolation/player.gd b/3d/physics_interpolation/player.gd
index 51816e71..2645a51b 100644
--- a/3d/physics_interpolation/player.gd
+++ b/3d/physics_interpolation/player.gd
@@ -114,7 +114,7 @@ func cycle_camera_type() -> void:
$Rig/Camera_TPS.make_current()
CameraType.CAM_TPS:
_cam_type = CameraType.CAM_FIXED
- get_node("../Camera_Fixed").make_current()
+ get_node(^"../Camera_Fixed").make_current()
# Hide body in FPS view (but keep shadow casting to improve spatial awareness).
if _cam_type == CameraType.CAM_FPS:
diff --git a/3d/physics_tests/tests/functional/test_moving_platform.gd b/3d/physics_tests/tests/functional/test_moving_platform.gd
index e2ac0a13..10e27700 100644
--- a/3d/physics_tests/tests/functional/test_moving_platform.gd
+++ b/3d/physics_tests/tests/functional/test_moving_platform.gd
@@ -160,7 +160,7 @@ func start_test() -> void:
animation_player.playback_process_mode = AnimationPlayer.ANIMATION_PROCESS_PHYSICS
else:
animation_player.playback_process_mode = AnimationPlayer.ANIMATION_PROCESS_IDLE
- animation_player.play("Move")
+ animation_player.play(&"Move")
$LabelBodyType.text = "Body Type: " + _body_type[_current_body_index] + " \nCollision Shape: " + _current_shape
diff --git a/3d/physics_tests/tests/performance/test_perf_broadphase.gd b/3d/physics_tests/tests/performance/test_perf_broadphase.gd
index a50b496e..8a95865b 100644
--- a/3d/physics_tests/tests/performance/test_perf_broadphase.gd
+++ b/3d/physics_tests/tests/performance/test_perf_broadphase.gd
@@ -152,7 +152,7 @@ func _remove_objects() -> void:
Log.print_log("* Removing objects...")
var timer := Time.get_ticks_usec()
- # Remove objects in reversed order to avoid the overhead of changing children index in parent.
+ # Remove objects in reversed order to avoid the overhead of changing child index in parent.
var object_count := _objects.size()
for object_index in object_count:
root_node.remove_child(_objects[object_count - object_index - 1])
diff --git a/3d/physics_tests/tests/performance/test_perf_contacts.gd b/3d/physics_tests/tests/performance/test_perf_contacts.gd
index 63a4d89a..6ec219e8 100644
--- a/3d/physics_tests/tests/performance/test_perf_contacts.gd
+++ b/3d/physics_tests/tests/performance/test_perf_contacts.gd
@@ -190,7 +190,7 @@ func _despawn_objects() -> void:
for spawn in spawns:
var spawn_parent := get_node(spawn)
- # Remove objects in reversed order to avoid the overhead of changing children index in parent.
+ # Remove objects in reversed order to avoid the overhead of changing child index in parent.
var object_count := spawn_parent.get_child_count()
for object_index in object_count:
var node := spawn_parent.get_child(object_count - object_index - 1)
diff --git a/3d/platformer/player/follow_camera.gd b/3d/platformer/player/follow_camera.gd
index df0560e8..7d7734e4 100644
--- a/3d/platformer/player/follow_camera.gd
+++ b/3d/platformer/player/follow_camera.gd
@@ -52,19 +52,19 @@ func _physics_process(delta: float) -> void:
target + Basis(Vector3.UP, deg_to_rad(autoturn_ray_aperture)) * (difference),
0xffffffff,
collision_exception
- ))
+ ))
var col := ds.intersect_ray(PhysicsRayQueryParameters3D.create(
target,
target + difference,
0xffffffff,
collision_exception
- ))
+ ))
var col_right := ds.intersect_ray(PhysicsRayQueryParameters3D.create(
target,
target + Basis(Vector3.UP, deg_to_rad(-autoturn_ray_aperture)) * (difference),
0xffffffff,
collision_exception
- ))
+ ))
if not col.is_empty():
# If main ray was occluded, get camera closer, this is the worst case scenario.
diff --git a/3d/platformer/player/player.gd b/3d/platformer/player/player.gd
index 3489277c..55bfacad 100644
--- a/3d/platformer/player/player.gd
+++ b/3d/platformer/player/player.gd
@@ -36,7 +36,7 @@ var coins := 0
func _physics_process(delta: float) -> void:
- if Input.is_action_pressed("reset_position") or global_position.y < -12:
+ if Input.is_action_pressed(&"reset_position") or global_position.y < -12:
# Player hit the reset button or fell off the map.
position = initial_position
velocity = Vector3.ZERO
@@ -48,10 +48,10 @@ func _physics_process(delta: float) -> void:
# Update coin count and its "parallax" copies.
# This gives text a pseudo-3D appearance while still using Label3D instead of the more limited TextMesh.
%CoinCount.text = str(coins)
- %CoinCount.get_node("Parallax").text = str(coins)
- %CoinCount.get_node("Parallax2").text = str(coins)
- %CoinCount.get_node("Parallax3").text = str(coins)
- %CoinCount.get_node("Parallax4").text = str(coins)
+ %CoinCount.get_node(^"Parallax").text = str(coins)
+ %CoinCount.get_node(^"Parallax2").text = str(coins)
+ %CoinCount.get_node(^"Parallax3").text = str(coins)
+ %CoinCount.get_node(^"Parallax4").text = str(coins)
velocity += gravity * delta
@@ -79,12 +79,12 @@ func _physics_process(delta: float) -> void:
if movement_direction.length() > 0.1 and not sharp_turn:
if horizontal_speed > 0.001:
horizontal_direction = adjust_facing(
- horizontal_direction,
- movement_direction,
- delta,
- 1.0 / horizontal_speed * TURN_SPEED,
- Vector3.UP
- )
+ horizontal_direction,
+ movement_direction,
+ delta,
+ 1.0 / horizontal_speed * TURN_SPEED,
+ Vector3.UP
+ )
else:
horizontal_direction = movement_direction
@@ -103,17 +103,17 @@ func _physics_process(delta: float) -> void:
if horizontal_speed > 0:
facing_mesh = adjust_facing(
- facing_mesh,
- movement_direction,
- delta,
- 1.0 / horizontal_speed * TURN_SPEED,
- Vector3.UP
- )
+ facing_mesh,
+ movement_direction,
+ delta,
+ 1.0 / horizontal_speed * TURN_SPEED,
+ Vector3.UP
+ )
var m3 := Basis(
- -facing_mesh,
- Vector3.UP,
- -facing_mesh.cross(Vector3.UP).normalized()
- ).scaled(CHAR_SCALE)
+ -facing_mesh,
+ Vector3.UP,
+ -facing_mesh.cross(Vector3.UP).normalized()
+ ).scaled(CHAR_SCALE)
$Player/Skeleton.set_transform(Transform3D(m3, mesh_xform.origin))
@@ -135,7 +135,7 @@ func _physics_process(delta: float) -> void:
horizontal_speed = 0
horizontal_velocity = horizontal_direction * horizontal_speed
- if Input.is_action_just_released("jump") and velocity.y > 0.0:
+ if Input.is_action_just_released(&"jump") and velocity.y > 0.0:
# Reduce jump height if releasing the jump key before reaching the apex.
vertical_velocity *= 0.7
@@ -160,8 +160,8 @@ func _physics_process(delta: float) -> void:
bullet.set_transform($Player/Skeleton/Bullet.get_global_transform().orthonormalized())
get_parent().add_child(bullet)
bullet.set_linear_velocity(
- $Player/Skeleton/Bullet.get_global_transform().basis[2].normalized() * BULLET_SPEED
- )
+ $Player/Skeleton/Bullet.get_global_transform().basis[2].normalized() * BULLET_SPEED
+ )
bullet.add_collision_exception_with(self)
$SoundShoot.play()
diff --git a/3d/sky_shaders/README.md b/3d/sky_shaders/README.md
index 50f1aaf5..3a894418 100644
--- a/3d/sky_shaders/README.md
+++ b/3d/sky_shaders/README.md
@@ -14,7 +14,7 @@ resource dropdown.
> **Warning**
>
> Sky shaders are rendered every frame if they use the `TIME` variable or are
-> otherwise updated every frame (e.g. if an uniform is updated in `_process()`
+> otherwise updated every frame (e.g. if a uniform is updated in `_process()`
> or with an AnimationPlayer). This has a significant performance impact for
> complex sky shaders. The performance impact can be reduced by adjusting the
> radiance map properties in Environment, but it will remain significant.
diff --git a/3d/sky_shaders/main.gd b/3d/sky_shaders/main.gd
index 2e83a9e8..8b70e79a 100644
--- a/3d/sky_shaders/main.gd
+++ b/3d/sky_shaders/main.gd
@@ -13,21 +13,21 @@ func _ready() -> void:
func _process(delta: float) -> void:
# Make the slider follow the day/night cycle.
$Panel/MarginContainer/VBoxContainer/TimeOfDay/HSlider.value = $AnimationPlayer.current_animation_position
- $WorldEnvironment.environment.sky.sky_material.set_shader_parameter("cloud_time_offset", $AnimationPlayer.current_animation_position)
+ $WorldEnvironment.environment.sky.sky_material.set_shader_parameter(&"cloud_time_offset", $AnimationPlayer.current_animation_position)
$YawCamera/Camera3D.fov = lerpf($YawCamera/Camera3D.fov, desired_fov, 1.0 - exp(-delta * 10.0))
func _input(event: InputEvent) -> void:
- if event.is_action_pressed("toggle_gui"):
+ if event.is_action_pressed(&"toggle_gui"):
$Panel.visible = not $Panel.visible
$Help.visible = not $Help.visible
- if event.is_action_pressed("toggle_spheres"):
+ if event.is_action_pressed(&"toggle_spheres"):
$Spheres.visible = not $Spheres.visible
- if event.is_action_pressed("toggle_mouse_capture"):
+ if event.is_action_pressed(&"toggle_mouse_capture"):
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
@@ -40,9 +40,9 @@ func _input(event: InputEvent) -> void:
$YawCamera.rotation.y -= relative_motion.x * MOUSE_SENSITIVITY
# Mouse wheel currently doesn't work in input actions. Hardcode mouse wheel as a workaround.
- if event.is_action_pressed("increase_camera_fov") or Input.is_mouse_button_pressed(MOUSE_BUTTON_WHEEL_DOWN):
+ if event.is_action_pressed(&"increase_camera_fov") or Input.is_mouse_button_pressed(MOUSE_BUTTON_WHEEL_DOWN):
desired_fov = clampf(desired_fov + 5.0, 20.0, 120.0)
- if event.is_action_pressed("decrease_camera_fov") or Input.is_mouse_button_pressed(MOUSE_BUTTON_WHEEL_UP):
+ if event.is_action_pressed(&"decrease_camera_fov") or Input.is_mouse_button_pressed(MOUSE_BUTTON_WHEEL_UP):
desired_fov = clampf(desired_fov - 5.0, 20.0, 120.0)
@@ -81,12 +81,12 @@ func update_speed_label() -> void:
func _on_cloud_coverage_value_changed(value: float) -> void:
- $WorldEnvironment.environment.sky.sky_material.set_shader_parameter("cloud_coverage", value)
+ $WorldEnvironment.environment.sky.sky_material.set_shader_parameter(&"cloud_coverage", value)
$Panel/MarginContainer/VBoxContainer/Clouds/CoverageValue.text = "%d%%" % (value * 100)
func _on_cloud_density_value_changed(value: float) -> void:
- $WorldEnvironment.environment.sky.sky_material.set_shader_parameter("cloud_density", value)
+ $WorldEnvironment.environment.sky.sky_material.set_shader_parameter(&"cloud_density", value)
$Panel/MarginContainer/VBoxContainer/Clouds/DensityValue.text = "%d%%" % (value * 100)
diff --git a/3d/sprites/scripts/player.gd b/3d/sprites/scripts/player.gd
index a2998058..1ee5b8de 100644
--- a/3d/sprites/scripts/player.gd
+++ b/3d/sprites/scripts/player.gd
@@ -9,8 +9,8 @@ var velocity: Vector3 = Vector3.ZERO
func _process(delta: float) -> void:
var input_vector: Vector2 = Vector2.ZERO
- input_vector.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
- input_vector.y = Input.get_action_strength("move_back") - Input.get_action_strength("move_forward")
+ input_vector.x = Input.get_action_strength(&"move_right") - Input.get_action_strength(&"move_left")
+ input_vector.y = Input.get_action_strength(&"move_back") - Input.get_action_strength(&"move_forward")
if input_vector.length() > 0:
input_vector = input_vector.normalized()
@@ -20,8 +20,8 @@ func _process(delta: float) -> void:
# Play corresponding animation.
if abs(input_vector.x) > abs(input_vector.y):
- sprite.play("walk_right" if input_vector.x > 0 else "walk_left")
+ sprite.play(&"walk_right" if input_vector.x > 0 else &"walk_left")
else:
- sprite.play("walk_down" if input_vector.y > 0 else "walk_up")
+ sprite.play(&"walk_down" if input_vector.y > 0 else &"walk_up")
else:
sprite.stop()
diff --git a/3d/squash_the_creeps/Main.gd b/3d/squash_the_creeps/Main.gd
index 9e1b377d..cca78e83 100644
--- a/3d/squash_the_creeps/Main.gd
+++ b/3d/squash_the_creeps/Main.gd
@@ -20,7 +20,7 @@ func _ready():
func _unhandled_input(event):
- if event.is_action_pressed("ui_accept") and $UserInterface/Retry.visible:
+ if event.is_action_pressed(&"ui_accept") and $UserInterface/Retry.visible:
get_tree().reload_current_scene()
@@ -29,7 +29,7 @@ func _on_mob_timer_timeout():
var mob = mob_scene.instantiate()
# Choose a random location on the SpawnPath.
- var mob_spawn_location = get_node("SpawnPath/SpawnLocation")
+ var mob_spawn_location = get_node(^"SpawnPath/SpawnLocation")
mob_spawn_location.progress_ratio = randf()
# Communicate the spawn location and the player's location to the mob.
diff --git a/3d/squash_the_creeps/Player.gd b/3d/squash_the_creeps/Player.gd
index b72dafa1..1c521e3c 100644
--- a/3d/squash_the_creeps/Player.gd
+++ b/3d/squash_the_creeps/Player.gd
@@ -14,13 +14,13 @@ signal hit
func _physics_process(delta):
var direction = Vector3.ZERO
- if Input.is_action_pressed("move_right"):
+ if Input.is_action_pressed(&"move_right"):
direction.x += 1
- if Input.is_action_pressed("move_left"):
+ if Input.is_action_pressed(&"move_left"):
direction.x -= 1
- if Input.is_action_pressed("move_back"):
+ if Input.is_action_pressed(&"move_back"):
direction.z += 1
- if Input.is_action_pressed("move_forward"):
+ if Input.is_action_pressed(&"move_forward"):
direction.z -= 1
if direction != Vector3.ZERO:
@@ -36,7 +36,7 @@ func _physics_process(delta):
velocity.z = direction.z * speed
# Jumping.
- if is_on_floor() and Input.is_action_just_pressed("jump"):
+ if is_on_floor() and Input.is_action_just_pressed(&"jump"):
velocity.y += jump_impulse
# We apply gravity every frame so the character always collides with the ground when moving.
@@ -52,7 +52,7 @@ func _physics_process(delta):
# If there are no "slides" this frame, the loop below won't run.
for index in range(get_slide_collision_count()):
var collision = get_slide_collision(index)
- if collision.get_collider().is_in_group("mob"):
+ if collision.get_collider().is_in_group(&"mob"):
var mob = collision.get_collider()
if Vector3.UP.dot(collision.get_normal()) > 0.1:
mob.squash()
diff --git a/3d/tonemap_color_correction/gradients/gradient_bars.gd b/3d/tonemap_color_correction/gradients/gradient_bars.gd
index 3c86e9d6..d777dbd6 100644
--- a/3d/tonemap_color_correction/gradients/gradient_bars.gd
+++ b/3d/tonemap_color_correction/gradients/gradient_bars.gd
@@ -7,15 +7,15 @@ class_name GradientBars extends Node3D
func set_num_steps(steps: int) -> void:
var shader_mat: ShaderMaterial = hdr_bar.material_override as ShaderMaterial
if shader_mat:
- shader_mat.set_shader_parameter("steps", min(1, steps))
+ shader_mat.set_shader_parameter(&"steps", min(1, steps))
func set_color(color: Color) -> void:
var shader_mat: ShaderMaterial = sdr_bar.material_override as ShaderMaterial
if shader_mat:
- shader_mat.set_shader_parameter("my_color", color)
+ shader_mat.set_shader_parameter(&"my_color", color)
shader_mat = hdr_bar.material_override as ShaderMaterial
if shader_mat:
- shader_mat.set_shader_parameter("my_color", color)
+ shader_mat.set_shader_parameter(&"my_color", color)
label.text = "#" + color.to_html(false)
diff --git a/3d/tonemap_color_correction/gradients/gradients_controls.gd b/3d/tonemap_color_correction/gradients/gradients_controls.gd
index bfbd6c5f..edea14da 100644
--- a/3d/tonemap_color_correction/gradients/gradients_controls.gd
+++ b/3d/tonemap_color_correction/gradients/gradients_controls.gd
@@ -22,10 +22,10 @@ func _on_steps_value_changed(value):
for bar_path in bars:
var bar = get_node(bar_path)
var shader_mat = bar.hdr_bar.material_override as ShaderMaterial
- shader_mat.set_shader_parameter("steps", value)
+ shader_mat.set_shader_parameter(&"steps", value)
if hues:
var shader_mat = hues.material_override as ShaderMaterial
- shader_mat.set_shader_parameter("steps", value)
+ shader_mat.set_shader_parameter(&"steps", value)
func _on_color_picker_button_color_changed(color):
@@ -37,10 +37,10 @@ func _on_exponential_toggled(button_pressed):
for bar_path in bars:
var bar = get_node(bar_path)
var shader_mat = bar.hdr_bar.material_override as ShaderMaterial
- shader_mat.set_shader_parameter("exponential_view", button_pressed)
+ shader_mat.set_shader_parameter(&"exponential_view", button_pressed)
shader_mat = bar.sdr_bar.material_override as ShaderMaterial
- shader_mat.set_shader_parameter("exponential_view", button_pressed)
+ shader_mat.set_shader_parameter(&"exponential_view", button_pressed)
if hues:
var shader_mat = hues.material_override as ShaderMaterial
- shader_mat.set_shader_parameter("exponential_view", button_pressed)
+ shader_mat.set_shader_parameter(&"exponential_view", button_pressed)
diff --git a/3d/tonemap_color_correction/neutral_luts/3d/create_neutral_3d_luts.gd b/3d/tonemap_color_correction/neutral_luts/3d/create_neutral_3d_luts.gd
index 89a98c86..a4a0445f 100644
--- a/3d/tonemap_color_correction/neutral_luts/3d/create_neutral_3d_luts.gd
+++ b/3d/tonemap_color_correction/neutral_luts/3d/create_neutral_3d_luts.gd
@@ -13,7 +13,7 @@ func create_neutral_lut(name: String, size: int, vertical: bool):
(size * size) if vertical else size,
false,
Image.FORMAT_RGB8
- )
+ )
for z in size:
var x_offset := int(z * size) if not vertical else 0
@@ -26,7 +26,7 @@ func create_neutral_lut(name: String, size: int, vertical: bool):
roundi(((x + 0.2) / float(size - 1)) * 255),
roundi(((y + 0.2) / float(size - 1)) * 255),
roundi(((z + 0.2) / float(size - 1)) * 255)
- ))
+ ))
image.save_png("user://" + name + ".png")
diff --git a/3d/truck_town/spedometer.gd b/3d/truck_town/spedometer.gd
index a10f6afa..0a8915d2 100644
--- a/3d/truck_town/spedometer.gd
+++ b/3d/truck_town/spedometer.gd
@@ -31,7 +31,7 @@ func _process(_delta: float) -> void:
text = "Speed: " + ("%.0f" % speed) + " mph"
# Change speedometer color depending on speed in m/s (regardless of unit).
- add_theme_color_override("font_color", gradient.sample(remap(car_body.linear_velocity.length(), 0.0, 30.0, 0.0, 1.0)))
+ add_theme_color_override(&"font_color", gradient.sample(remap(car_body.linear_velocity.length(), 0.0, 30.0, 0.0, 1.0)))
func _on_spedometer_pressed() -> void:
diff --git a/3d/visibility_ranges/camera.gd b/3d/visibility_ranges/camera.gd
index 222d1078..99bd5508 100644
--- a/3d/visibility_ranges/camera.gd
+++ b/3d/visibility_ranges/camera.gd
@@ -20,7 +20,7 @@ func _input(input_event: InputEvent) -> void:
rot.x = clampf(rot.x - input_event.relative.y * MOUSE_SENSITIVITY, -1.57, 1.57)
transform.basis = Basis.from_euler(rot)
- if input_event.is_action_pressed("toggle_mouse_capture"):
+ if input_event.is_action_pressed(&"toggle_mouse_capture"):
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
@@ -32,7 +32,7 @@ func _process(delta: float) -> void:
Input.get_axis(&"move_left", &"move_right"),
0,
Input.get_axis(&"move_forward", &"move_back")
- )
+ )
# Normalize motion to prevent diagonal movement from being
# `sqrt(2)` times faster than straight movement.
diff --git a/3d/volumetric_fog/camera.gd b/3d/volumetric_fog/camera.gd
index 9787a1b0..57ccef31 100644
--- a/3d/volumetric_fog/camera.gd
+++ b/3d/volumetric_fog/camera.gd
@@ -18,10 +18,10 @@ func _ready() -> void:
func _process(delta: float) -> void:
var motion := Vector3(
- Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
+ Input.get_action_strength(&"move_right") - Input.get_action_strength(&"move_left"),
0,
- Input.get_action_strength("move_back") - Input.get_action_strength("move_forward")
- )
+ Input.get_action_strength(&"move_back") - Input.get_action_strength(&"move_forward")
+ )
# Normalize motion to prevent diagonal movement from being
# `sqrt(2)` times faster than straight movement.
@@ -41,33 +41,33 @@ func _input(event: InputEvent) -> void:
rot.x = clamp(rot.x - event.screen_relative.y * MOUSE_SENSITIVITY, -1.57, 1.57)
transform.basis = Basis.from_euler(rot)
- if event.is_action_pressed("toggle_mouse_capture"):
+ if event.is_action_pressed(&"toggle_mouse_capture"):
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
- if event.is_action_pressed("toggle_temporal_reprojection"):
+ if event.is_action_pressed(&"toggle_temporal_reprojection"):
get_world_3d().environment.volumetric_fog_temporal_reprojection_enabled = not get_world_3d().environment.volumetric_fog_temporal_reprojection_enabled
update_label()
- elif event.is_action_pressed("increase_temporal_reprojection"):
+ elif event.is_action_pressed(&"increase_temporal_reprojection"):
get_world_3d().environment.volumetric_fog_temporal_reprojection_amount = clamp(get_world_3d().environment.volumetric_fog_temporal_reprojection_amount + 0.01, 0.5, 0.99)
update_label()
- elif event.is_action_pressed("decrease_temporal_reprojection"):
+ elif event.is_action_pressed(&"decrease_temporal_reprojection"):
get_world_3d().environment.volumetric_fog_temporal_reprojection_amount = clamp(get_world_3d().environment.volumetric_fog_temporal_reprojection_amount - 0.01, 0.5, 0.99)
update_label()
- elif event.is_action_pressed("increase_fog_density"):
+ elif event.is_action_pressed(&"increase_fog_density"):
get_world_3d().environment.volumetric_fog_density = clamp(get_world_3d().environment.volumetric_fog_density + 0.01, 0.0, 1.0)
update_label()
- elif event.is_action_pressed("decrease_fog_density"):
+ elif event.is_action_pressed(&"decrease_fog_density"):
get_world_3d().environment.volumetric_fog_density = clamp(get_world_3d().environment.volumetric_fog_density - 0.01, 0.0, 1.0)
update_label()
- elif event.is_action_pressed("increase_volumetric_fog_quality"):
+ elif event.is_action_pressed(&"increase_volumetric_fog_quality"):
volumetric_fog_volume_size = clamp(volumetric_fog_volume_size + 16, 16, 384)
volumetric_fog_volume_depth = clamp(volumetric_fog_volume_depth + 16, 16, 384)
RenderingServer.environment_set_volumetric_fog_volume_size(volumetric_fog_volume_size, volumetric_fog_volume_depth)
update_label()
- elif event.is_action_pressed("decrease_volumetric_fog_quality"):
+ elif event.is_action_pressed(&"decrease_volumetric_fog_quality"):
volumetric_fog_volume_size = clamp(volumetric_fog_volume_size - 16, 16, 384)
volumetric_fog_volume_depth = clamp(volumetric_fog_volume_depth - 16, 16, 384)
RenderingServer.environment_set_volumetric_fog_volume_size(volumetric_fog_volume_size, volumetric_fog_volume_depth)
@@ -77,16 +77,16 @@ func _input(event: InputEvent) -> void:
func update_label() -> void:
if get_world_3d().environment.volumetric_fog_temporal_reprojection_enabled:
label.text = "Fog density: %.2f\nTemporal reprojection: Enabled\nTemporal reprojection strength: %.2f\nVolumetric fog quality: %d×%d×%d" % [
- get_world_3d().environment.volumetric_fog_density,
- get_world_3d().environment.volumetric_fog_temporal_reprojection_amount,
- volumetric_fog_volume_size,
- volumetric_fog_volume_size,
- volumetric_fog_volume_depth,
- ]
+ get_world_3d().environment.volumetric_fog_density,
+ get_world_3d().environment.volumetric_fog_temporal_reprojection_amount,
+ volumetric_fog_volume_size,
+ volumetric_fog_volume_size,
+ volumetric_fog_volume_depth,
+ ]
else:
label.text = "Fog density: %.2f\nTemporal reprojection: Disabled\nVolumetric fog quality: %d×%d×%d" % [
- get_world_3d().environment.volumetric_fog_density,
- volumetric_fog_volume_size,
- volumetric_fog_volume_size,
- volumetric_fog_volume_depth,
- ]
+ get_world_3d().environment.volumetric_fog_density,
+ volumetric_fog_volume_size,
+ volumetric_fog_volume_size,
+ volumetric_fog_volume_depth,
+ ]
diff --git a/3d/voxel/player/player.gd b/3d/voxel/player/player.gd
index febcc3b7..570a2168 100644
--- a/3d/voxel/player/player.gd
+++ b/3d/voxel/player/player.gd
@@ -62,7 +62,7 @@ func _process(_delta: float) -> void:
aim_preview.global_position = Vector3(ray_current_block_position) + Vector3(0.5, 0.5, 0.5)
var breaking := Input.is_action_just_pressed(&"break")
var placing := Input.is_action_just_pressed(&"place")
- # Either both buttons were pressed or neither are, so stop.
+ # Either both buttons were pressed or neither is, so stop.
if breaking == placing:
return
@@ -87,7 +87,7 @@ func _physics_process(delta: float) -> void:
head.transform.origin.y = lerpf(head.transform.origin.y, EYE_HEIGHT_CROUCH if crouching else EYE_HEIGHT_STAND, 1.0 - exp(-delta * 16.0))
# Keyboard movement.
- var movement_vec2: Vector2 = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
+ var movement_vec2: Vector2 = Input.get_vector(&"move_left", &"move_right", &"move_forward", &"move_back")
var movement: Vector3 = transform.basis * (Vector3(movement_vec2.x, 0, movement_vec2.y))
if is_on_floor():
diff --git a/3d/voxel/world/chunk.gd b/3d/voxel/world/chunk.gd
index fd21a3f4..0f2943e4 100644
--- a/3d/voxel/world/chunk.gd
+++ b/3d/voxel/world/chunk.gd
@@ -226,26 +226,26 @@ static func calculate_block_uvs(block_id: int) -> Array[Vector2]:
var col := block_id % TEXTURE_SHEET_WIDTH
return [
- # Godot 4 has a weird bug where there are seams at the edge
- # of the textures. Adding a margin of 0.01 "fixes" it.
- TEXTURE_TILE_SIZE * Vector2(col + 0.01, row + 0.01),
- TEXTURE_TILE_SIZE * Vector2(col + 0.01, row + 0.99),
- TEXTURE_TILE_SIZE * Vector2(col + 0.99, row + 0.01),
- TEXTURE_TILE_SIZE * Vector2(col + 0.99, row + 0.99),
- ]
+ # Godot 4 has a weird bug where there are seams at the edge
+ # of the textures. Adding a margin of 0.01 "fixes" it.
+ TEXTURE_TILE_SIZE * Vector2(col + 0.01, row + 0.01),
+ TEXTURE_TILE_SIZE * Vector2(col + 0.01, row + 0.99),
+ TEXTURE_TILE_SIZE * Vector2(col + 0.99, row + 0.01),
+ TEXTURE_TILE_SIZE * Vector2(col + 0.99, row + 0.99),
+ ]
static func calculate_block_verts(block_position: Vector3) -> Array[Vector3]:
return [
- Vector3(block_position.x, block_position.y, block_position.z),
- Vector3(block_position.x, block_position.y, block_position.z + 1),
- Vector3(block_position.x, block_position.y + 1, block_position.z),
- Vector3(block_position.x, block_position.y + 1, block_position.z + 1),
- Vector3(block_position.x + 1, block_position.y, block_position.z),
- Vector3(block_position.x + 1, block_position.y, block_position.z + 1),
- Vector3(block_position.x + 1, block_position.y + 1, block_position.z),
- Vector3(block_position.x + 1, block_position.y + 1, block_position.z + 1),
- ]
+ Vector3(block_position.x, block_position.y, block_position.z),
+ Vector3(block_position.x, block_position.y, block_position.z + 1),
+ Vector3(block_position.x, block_position.y + 1, block_position.z),
+ Vector3(block_position.x, block_position.y + 1, block_position.z + 1),
+ Vector3(block_position.x + 1, block_position.y, block_position.z),
+ Vector3(block_position.x + 1, block_position.y, block_position.z + 1),
+ Vector3(block_position.x + 1, block_position.y + 1, block_position.z),
+ Vector3(block_position.x + 1, block_position.y + 1, block_position.z + 1),
+ ]
static func is_block_transparent(block_id: int) -> int:
diff --git a/3d/waypoints/camera.gd b/3d/waypoints/camera.gd
index 5ab4646b..cd3c9539 100644
--- a/3d/waypoints/camera.gd
+++ b/3d/waypoints/camera.gd
@@ -31,7 +31,7 @@ func _process(delta: float) -> void:
Input.get_axis(&"move_left", &"move_right"),
0,
Input.get_axis(&"move_forward", &"move_back")
- )
+ )
# Normalize motion to prevent diagonal movement from being
# `sqrt(2)` times faster than straight movement.
diff --git a/3d/waypoints/waypoint.gd b/3d/waypoints/waypoint.gd
index 804ba27e..8a318fc7 100644
--- a/3d/waypoints/waypoint.gd
+++ b/3d/waypoints/waypoint.gd
@@ -47,7 +47,7 @@ func _process(_delta: float) -> void:
var viewport_base_size: Vector2i = (
get_viewport().content_scale_size if get_viewport().content_scale_size > Vector2i(0, 0)
else get_viewport().size
- )
+ )
if not sticky:
# For non-sticky waypoints, we don't need to clamp and calculate
@@ -80,7 +80,7 @@ func _process(_delta: float) -> void:
position = Vector2(
clamp(unprojected_position.x, MARGIN, viewport_base_size.x - MARGIN),
clamp(unprojected_position.y, MARGIN, viewport_base_size.y - MARGIN)
- )
+ )
label.visible = true
rotation = 0
diff --git a/audio/mic_record/MicRecord.gd b/audio/mic_record/MicRecord.gd
index 184ab313..d118be2c 100644
--- a/audio/mic_record/MicRecord.gd
+++ b/audio/mic_record/MicRecord.gd
@@ -9,7 +9,7 @@ var format := AudioStreamWAV.FORMAT_16_BITS # This is the default format on rec
func _ready() -> void:
- var idx := AudioServer.get_bus_index("Record")
+ var idx := AudioServer.get_bus_index(&"Record")
effect = AudioServer.get_bus_effect(idx, 0)
diff --git a/audio/rhythm_game/game_state/conductor.gd b/audio/rhythm_game/game_state/conductor.gd
index 39896801..c703fa10 100644
--- a/audio/rhythm_game/game_state/conductor.gd
+++ b/audio/rhythm_game/game_state/conductor.gd
@@ -69,17 +69,17 @@ func _process(_delta: float) -> void:
# First, calculate the song time using data from the audio thread. This
# value is very jittery, but will always match what the player is hearing.
_song_time_audio = (
- player.get_playback_position()
- # The 1st beat may not start at second 0 of the audio track. Compensate
- # with an offset setting.
- - first_beat_offset_ms / 1000.0
- # For most platforms, the playback position value updates in chunks,
- # with each chunk being one "mix". Smooth this out by adding in the time
- # since the last chunk was processed.
- + last_mix
- # Current processed audio is heard later.
- - _cached_output_latency
- )
+ player.get_playback_position()
+ # The 1st beat may not start at second 0 of the audio track. Compensate
+ # with an offset setting.
+ - first_beat_offset_ms / 1000.0
+ # For most platforms, the playback position value updates in chunks,
+ # with each chunk being one "mix". Smooth this out by adding in the time
+ # since the last chunk was processed.
+ + last_mix
+ # Current processed audio is heard later.
+ - _cached_output_latency
+ )
# Next, calculate the song time using the system clock at render rate. This
# value is very stable, but can drift from the playing audio due to pausing,
@@ -126,17 +126,17 @@ func play() -> void:
# Capture the start of the song using the system clock.
_song_time_begin = (
- Time.get_ticks_usec() / 1000000.0
- # The 1st beat may not start at second 0 of the audio track. Compensate
- # with an offset setting.
- + first_beat_offset_ms / 1000.0
- # Playback does not start immediately, but only when the next audio
- # chunk is processed (the "mix" step). Add in the time until that
- # happens.
- + AudioServer.get_time_to_next_mix()
- # Add in additional output latency.
- + _cached_output_latency
- )
+ Time.get_ticks_usec() / 1000000.0
+ # The 1st beat may not start at second 0 of the audio track. Compensate
+ # with an offset setting.
+ + first_beat_offset_ms / 1000.0
+ # Playback does not start immediately, but only when the next audio
+ # chunk is processed (the "mix" step). Add in the time until that
+ # happens.
+ + AudioServer.get_time_to_next_mix()
+ # Add in additional output latency.
+ + _cached_output_latency
+ )
func stop() -> void:
diff --git a/audio/rhythm_game/game_state/note_manager.gd b/audio/rhythm_game/game_state/note_manager.gd
index 22181c53..63ca6e83 100644
--- a/audio/rhythm_game/game_state/note_manager.gd
+++ b/audio/rhythm_game/game_state/note_manager.gd
@@ -24,9 +24,9 @@ var _hit_count: int = 0
func _ready() -> void:
_play_stats = PlayStats.new()
_play_stats.changed.connect(
- func() -> void:
- play_stats_updated.emit(_play_stats)
- )
+ func() -> void:
+ play_stats_updated.emit(_play_stats)
+ )
var chart_data := ChartData.get_chart_data(chart)
@@ -58,7 +58,7 @@ func _process(_delta: float) -> void:
_miss_old_notes()
- if Input.is_action_just_pressed("main_key"):
+ if Input.is_action_just_pressed(&"main_key"):
_handle_keypress()
if _notes.is_empty():
diff --git a/audio/rhythm_game/game_state/play_stats.gd b/audio/rhythm_game/game_state/play_stats.gd
index 9bab3ab8..46a48e88 100644
--- a/audio/rhythm_game/game_state/play_stats.gd
+++ b/audio/rhythm_game/game_state/play_stats.gd
@@ -6,16 +6,19 @@ extends Resource
if mean_hit_error != value:
mean_hit_error = value
emit_changed()
+
@export var perfect_count: int = 0:
set(value):
if perfect_count != value:
perfect_count = value
emit_changed()
+
@export var good_count: int = 0:
set(value):
if good_count != value:
good_count = value
emit_changed()
+
@export var miss_count: int = 0:
set(value):
if miss_count != value:
diff --git a/audio/rhythm_game/globals/one_euro_filter.gd b/audio/rhythm_game/globals/one_euro_filter.gd
index 9aa761d4..a8b865de 100644
--- a/audio/rhythm_game/globals/one_euro_filter.gd
+++ b/audio/rhythm_game/globals/one_euro_filter.gd
@@ -18,12 +18,14 @@ func _init(args: Variant) -> void:
x_filter = LowPassFilter.new()
dx_filter = LowPassFilter.new()
+
func alpha(rate: float, cutoff: float) -> float:
var tau: float = 1.0 / (2 * PI * cutoff)
var te: float = 1.0 / rate
return 1.0 / (1.0 + tau/te)
+
func filter(value: float, delta: float) -> float:
var rate: float = 1.0 / delta
var dx: float = (value - x_filter.last_value) * rate
@@ -32,12 +34,15 @@ func filter(value: float, delta: float) -> float:
var cutoff: float = min_cutoff + beta * abs(edx)
return x_filter.filter(value, alpha(rate, cutoff))
+
class LowPassFilter:
var last_value: float
+
func _init() -> void:
last_value = 0
+
func filter(value: float, alpha: float) -> float:
var result := alpha * value + (1 - alpha) * last_value
last_value = result
diff --git a/audio/rhythm_game/objects/guide/guide.gd b/audio/rhythm_game/objects/guide/guide.gd
index 27820377..2b8033cf 100644
--- a/audio/rhythm_game/objects/guide/guide.gd
+++ b/audio/rhythm_game/objects/guide/guide.gd
@@ -4,9 +4,9 @@ var _guide_tween: Tween
func _process(_delta: float) -> void:
- if Input.is_action_just_pressed("main_key"):
+ if Input.is_action_just_pressed(&"main_key"):
scale = 1.2 * Vector2.ONE
if _guide_tween:
_guide_tween.kill()
_guide_tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC)
- _guide_tween.tween_property(self, "scale", Vector2.ONE, 0.2)
+ _guide_tween.tween_property(self, ^"scale", Vector2.ONE, 0.2)
diff --git a/audio/rhythm_game/objects/note/note.gd b/audio/rhythm_game/objects/note/note.gd
index c79750b6..aac8449d 100644
--- a/audio/rhythm_game/objects/note/note.gd
+++ b/audio/rhythm_game/objects/note/note.gd
@@ -42,8 +42,8 @@ func hit_perfect() -> void:
var tween := create_tween()
tween.set_ease(Tween.EASE_OUT)
tween.set_trans(Tween.TRANS_QUAD)
- tween.parallel().tween_property(self, "modulate:a", 0, 0.2)
- tween.parallel().tween_property($Sprite2D, "scale", 1.5 * Vector2.ONE, 0.2)
+ tween.parallel().tween_property(self, ^"modulate:a", 0, 0.2)
+ tween.parallel().tween_property($Sprite2D, ^"scale", 1.5 * Vector2.ONE, 0.2)
tween.tween_callback(queue_free)
@@ -55,8 +55,8 @@ func hit_good() -> void:
var tween := create_tween()
tween.set_ease(Tween.EASE_OUT)
tween.set_trans(Tween.TRANS_QUAD)
- tween.parallel().tween_property(self, "modulate:a", 0, 0.2)
- tween.parallel().tween_property($Sprite2D, "scale", 1.2 * Vector2.ONE, 0.2)
+ tween.parallel().tween_property(self, ^"modulate:a", 0, 0.2)
+ tween.parallel().tween_property($Sprite2D, ^"scale", 1.2 * Vector2.ONE, 0.2)
tween.tween_callback(queue_free)
@@ -66,7 +66,7 @@ func miss(stop_movement: bool = true) -> void:
modulate = Color.DARK_RED
var tween := create_tween()
- tween.parallel().tween_property(self, "modulate:a", 0, 0.5)
+ tween.parallel().tween_property(self, ^"modulate:a", 0, 0.5)
tween.tween_callback(queue_free)
diff --git a/audio/rhythm_game/scenes/main/main.gd b/audio/rhythm_game/scenes/main/main.gd
index 8b71d440..602f1771 100644
--- a/audio/rhythm_game/scenes/main/main.gd
+++ b/audio/rhythm_game/scenes/main/main.gd
@@ -41,7 +41,7 @@ func _ready() -> void:
func _process(_delta: float) -> void:
- if Input.is_action_just_pressed("restart"):
+ if Input.is_action_just_pressed(&"restart"):
get_tree().reload_current_scene()
$Control/ErrorGraphVBox/CenterContainer/TimeGraph.queue_redraw()
@@ -112,8 +112,8 @@ func _on_note_hit(beat: float, hit_type: Enums.HitType, hit_error: float) -> voi
_judgment_tween.kill()
_judgment_tween = create_tween()
_judgment_tween.tween_interval(0.2)
- _judgment_tween.tween_property($Control/JudgmentHBox/LJudgmentLabel, "modulate:a", 0, 0.5)
- _judgment_tween.parallel().tween_property($Control/JudgmentHBox/RJudgmentLabel, "modulate:a", 0, 0.5)
+ _judgment_tween.tween_property($Control/JudgmentHBox/LJudgmentLabel, ^"modulate:a", 0, 0.5)
+ _judgment_tween.parallel().tween_property($Control/JudgmentHBox/RJudgmentLabel, ^"modulate:a", 0, 0.5)
_hit_data.append(NoteHitData.new(beat, hit_type, hit_error))
$Control/ErrorGraphVBox/CenterContainer/JudgmentsGraph.queue_redraw()
diff --git a/audio/rhythm_game/scenes/main/pause_handler.gd b/audio/rhythm_game/scenes/main/pause_handler.gd
index 8fdc3d49..79147445 100644
--- a/audio/rhythm_game/scenes/main/pause_handler.gd
+++ b/audio/rhythm_game/scenes/main/pause_handler.gd
@@ -3,6 +3,6 @@ extends Node
func _process(_delta: float) -> void:
- if Input.is_action_just_pressed("pause"):
+ if Input.is_action_just_pressed(&"pause"):
get_tree().paused = not get_tree().paused
$"../Control/PauseLabel".visible = get_tree().paused
diff --git a/audio/spectrum/show_spectrum.gd b/audio/spectrum/show_spectrum.gd
index 4ec46f1b..ef2e83de 100644
--- a/audio/spectrum/show_spectrum.gd
+++ b/audio/spectrum/show_spectrum.gd
@@ -24,27 +24,27 @@ func _draw() -> void:
draw_rect(
Rect2(w * i, HEIGHT - height, w - 2, height),
Color.from_hsv(float(VU_COUNT * 0.6 + i * 0.5) / VU_COUNT, 0.5, 0.6)
- )
+ )
draw_line(
Vector2(w * i, HEIGHT - height),
Vector2(w * i + w - 2, HEIGHT - height),
Color.from_hsv(float(VU_COUNT * 0.6 + i * 0.5) / VU_COUNT, 0.5, 1.0),
2.0,
true
- )
+ )
# Draw a reflection of the bars with lower opacity.
draw_rect(
Rect2(w * i, HEIGHT, w - 2, height),
Color.from_hsv(float(VU_COUNT * 0.6 + i * 0.5) / VU_COUNT, 0.5, 0.6) * Color(1, 1, 1, 0.125)
- )
+ )
draw_line(
Vector2(w * i, HEIGHT + height),
Vector2(w * i + w - 2, HEIGHT + height),
Color.from_hsv(float(VU_COUNT * 0.6 + i * 0.5) / VU_COUNT, 0.5, 1.0) * Color(1, 1, 1, 0.125),
2.0,
true
- )
+ )
func _process(_delta: float) -> void:
diff --git a/compute/heightmap/README.md b/compute/heightmap/README.md
index f1ba486b..dcaa376a 100644
--- a/compute/heightmap/README.md
+++ b/compute/heightmap/README.md
@@ -12,7 +12,7 @@ can try both options to compare the time it takes to generate the heightmap on
the CPU and GPU respectively.
For smaller noise textures, the CPU will often be faster, but the larger the
-gains are by using the GPU. On a PC with a NVIDIA GeForce RTX 3060 and
+gains are by using the GPU. On a PC with an NVIDIA GeForce RTX 3060 and
11th-generation Intel Core i7 processor, the compute shader was tested to be
faster for textures 1024×1024 and larger.
diff --git a/compute/post_shader/post_process_grayscale.gd b/compute/post_shader/post_process_grayscale.gd
index 072a1e12..505acdbc 100644
--- a/compute/post_shader/post_process_grayscale.gd
+++ b/compute/post_shader/post_process_grayscale.gd
@@ -60,11 +60,11 @@ func _render_callback(p_effect_callback_type: EffectCallbackType, p_render_data:
# Create push constant.
# Must be aligned to 16 bytes and be in the same order as defined in the shader.
var push_constant := PackedFloat32Array([
- size.x,
- size.y,
- 0.0,
- 0.0,
- ])
+ size.x,
+ size.y,
+ 0.0,
+ 0.0,
+ ])
# Loop through views just in case we're doing stereo rendering. No extra cost if this is mono.
var view_count: int = render_scene_buffers.get_view_count()
diff --git a/compute/post_shader/post_process_shader.gd b/compute/post_shader/post_process_shader.gd
index 0e4e4f51..7d01250e 100644
--- a/compute/post_shader/post_process_shader.gd
+++ b/compute/post_shader/post_process_shader.gd
@@ -151,11 +151,11 @@ func _render_callback(p_effect_callback_type: EffectCallbackType, p_render_data:
# Create push constant.
# Must be aligned to 16 bytes and be in the same order as defined in the shader.
var push_constant := PackedFloat32Array([
- size.x,
- size.y,
- 0.0,
- 0.0,
- ])
+ size.x,
+ size.y,
+ 0.0,
+ 0.0,
+ ])
# Make sure we have a sampler.
if not nearest_sampler.is_valid():
diff --git a/compute/texture/water_plane/water_plane.gd b/compute/texture/water_plane/water_plane.gd
index c55e7e3e..72c624f0 100644
--- a/compute/texture/water_plane/water_plane.gd
+++ b/compute/texture/water_plane/water_plane.gd
@@ -41,10 +41,10 @@ func _ready() -> void:
# Get our texture from our material so we set our RID.
var material: ShaderMaterial = $MeshInstance3D.material_override
if material:
- material.set_shader_parameter("effect_texture_size", texture_size)
+ material.set_shader_parameter(&"effect_texture_size", texture_size)
# Get our texture object.
- texture = material.get_shader_parameter("effect_texture")
+ texture = material.get_shader_parameter(&"effect_texture")
func _exit_tree() -> void:
@@ -173,10 +173,10 @@ func _initialize_compute_code(init_with_texture_size: Vector2i) -> void:
tf.array_layers = 1
tf.mipmaps = 1
tf.usage_bits = (
- RenderingDevice.TEXTURE_USAGE_SAMPLING_BIT |
- RenderingDevice.TEXTURE_USAGE_STORAGE_BIT |
- RenderingDevice.TEXTURE_USAGE_CAN_COPY_TO_BIT
- )
+ RenderingDevice.TEXTURE_USAGE_SAMPLING_BIT |
+ RenderingDevice.TEXTURE_USAGE_STORAGE_BIT |
+ RenderingDevice.TEXTURE_USAGE_CAN_COPY_TO_BIT
+ )
for i in 3:
# Create our texture.
diff --git a/gui/accessibility/custom_control.gd b/gui/accessibility/custom_control.gd
index 70d80f83..c456fea1 100644
--- a/gui/accessibility/custom_control.gd
+++ b/gui/accessibility/custom_control.gd
@@ -119,7 +119,7 @@ func _draw() -> void:
# Draw, provided for convenience and NOT required for screen-reader support.
for i in range(item_aes.size()):
draw_rect(item_rects[selected], Color(0.8, 0.8, 0.8, 0.5), false, 1.0)
- draw_string(get_theme_font("font"), item_rects[i].position + Vector2(0, 30), str(item_values[i]), HORIZONTAL_ALIGNMENT_CENTER, 40.0)
+ draw_string(get_theme_font(&"font"), item_rects[i].position + Vector2(0, 30), str(item_values[i]), HORIZONTAL_ALIGNMENT_CENTER, 40.0)
if has_focus():
draw_rect(Rect2(Vector2(), get_size()), Color(0, 0, 1, 0.5), false, 3.0)
diff --git a/gui/bidi_and_font_features/bidi.gd b/gui/bidi_and_font_features/bidi.gd
index 1dc9e3bd..4025fc4f 100644
--- a/gui/bidi_and_font_features/bidi.gd
+++ b/gui/bidi_and_font_features/bidi.gd
@@ -1,6 +1,6 @@
extends Control
-@onready var variable_font_variation: FontVariation = $"TabContainer/Variable fonts/VariableFontPreview".get_theme_font("font")
+@onready var variable_font_variation: FontVariation = $"TabContainer/Variable fonts/VariableFontPreview".get_theme_font(&"font")
func _ready() -> void:
@@ -51,7 +51,7 @@ func _on_LineEditCustomSTDst_tree_entered() -> void:
func _on_variable_size_value_changed(value: float) -> void:
$"TabContainer/Variable fonts/Variables/Size/Value".text = str(value)
# This is also available on non-variable fonts.
- $"TabContainer/Variable fonts/VariableFontPreview".add_theme_font_size_override("font_size", value)
+ $"TabContainer/Variable fonts/VariableFontPreview".add_theme_font_size_override(&"font_size", value)
func _on_variable_weight_value_changed(value: float) -> void:
@@ -116,7 +116,7 @@ func _on_system_font_weight_value_changed(value: float) -> void:
$"TabContainer/System fonts/VBoxContainer/Fantasy/Value",
$"TabContainer/System fonts/VBoxContainer/Custom/Value"
]:
- var system_font: SystemFont = label.get_theme_font("font")
+ var system_font: SystemFont = label.get_theme_font(&"font")
system_font.font_weight = int(value)
func _on_system_font_italic_toggled(button_pressed: bool) -> void:
@@ -128,10 +128,10 @@ func _on_system_font_italic_toggled(button_pressed: bool) -> void:
$"TabContainer/System fonts/VBoxContainer/Fantasy/Value",
$"TabContainer/System fonts/VBoxContainer/Custom/Value"
]:
- var system_font: SystemFont = label.get_theme_font("font")
+ var system_font: SystemFont = label.get_theme_font(&"font")
system_font.font_italic = button_pressed
func _on_system_font_name_text_changed(new_text: String) -> void:
- var system_font: SystemFont = $"TabContainer/System fonts/VBoxContainer/Custom/FontName".get_theme_font("font")
+ var system_font: SystemFont = $"TabContainer/System fonts/VBoxContainer/Custom/FontName".get_theme_font(&"font")
system_font.font_names[0] = new_text
diff --git a/gui/control_gallery/README.md b/gui/control_gallery/README.md
index b7360ff9..96ff46e9 100644
--- a/gui/control_gallery/README.md
+++ b/gui/control_gallery/README.md
@@ -4,7 +4,7 @@ Showcases various Control nodes with their names affixed for easy recognition.
This demo is inspired by similar "control gallery" demos found in GUI toolkits
such as GTK.
-The 3 main panels ("Basic controls", "Numbers" and "Lists")
+The 3 main panels ("Basic controls", "Numbers", and "Lists")
are separated using HSplitContainer and VSplitContainer nodes.
This makes their individual size adjustable. Drag the empty
space between panels to resize them.
diff --git a/gui/gd_paint/paint_control.gd b/gui/gd_paint/paint_control.gd
index be6782f7..265e49cb 100644
--- a/gui/gd_paint/paint_control.gd
+++ b/gui/gd_paint/paint_control.gd
@@ -82,7 +82,7 @@ func _process(_delta: float) -> void:
# add the brush object to draw_elements_array.
if brush_mode == BrushMode.CIRCLE_SHAPE or brush_mode == BrushMode.RECTANGLE_SHAPE:
add_brush(mouse_pos, brush_mode)
- # We handle undo's differently than either pencil or eraser mode, so we need to set undo
+ # We handle undos differently than either pencil or eraser mode, so we need to set undo
# element_list_num to -2 so we can tell if we need to undo a shape. See undo_stroke for details.
undo_element_list_num = UNDO_MODE_SHAPE
# Since we've released the left mouse, we need to get a new mouse_click_start_pos next time
@@ -119,9 +119,9 @@ func undo_stroke() -> void:
# Now that we've undone a shape, we cannot undo again until another stoke is added.
undo_element_list_num = UNDO_NONE
# NOTE: if we only had shape brushes, then we could remove the above line and could let the user
- # undo until we have a empty element list.
+ # undo until we have an empty element list.
- # Otherwise we're removing a either a pencil stroke or a eraser stroke.
+ # Otherwise we're removing either a pencil stroke or an eraser stroke.
else:
# Figure out how many elements/brushes we've added in the last stroke.
var elements_to_remove := brush_data_list.size() - undo_element_list_num
@@ -204,7 +204,7 @@ func _draw() -> void:
draw_circle(brush.brush_pos, brush.brush_size / 2, brush.brush_color)
BrushMode.ERASER:
# NOTE: this is a really cheap way of erasing that isn't really erasing!
- # However, this gives similar results in a fairy simple way!
+ # However, this gives similar results in a fairly simple way!
# Erasing works exactly the same was as pencil does for both the rectangle shape and the circle shape,
# but instead of using brush.brush_color, we instead use bg_color instead.
diff --git a/gui/msdf_font/sdf_font_demo.gd b/gui/msdf_font/sdf_font_demo.gd
index 10c48f31..578dab17 100644
--- a/gui/msdf_font/sdf_font_demo.gd
+++ b/gui/msdf_font/sdf_font_demo.gd
@@ -2,20 +2,20 @@ extends Control
func _input(event: InputEvent) -> void:
if event.is_action_pressed(&"toggle_msdf_font"):
- if %FontLabel.get_theme_font("font").multichannel_signed_distance_field:
- %FontLabel.add_theme_font_override("font", preload("res://montserrat_semibold.ttf"))
+ if %FontLabel.get_theme_font(&"font").multichannel_signed_distance_field:
+ %FontLabel.add_theme_font_override(&"font", preload("res://montserrat_semibold.ttf"))
else:
- %FontLabel.add_theme_font_override("font", preload("res://montserrat_semibold_msdf.ttf"))
+ %FontLabel.add_theme_font_override(&"font", preload("res://montserrat_semibold_msdf.ttf"))
update_label()
func update_label() -> void:
%FontMode.text = "Font rendering: %s" % (
- "MSDF" if %FontLabel.get_theme_font("font").multichannel_signed_distance_field else "Traditional"
- )
+ "MSDF" if %FontLabel.get_theme_font(&"font").multichannel_signed_distance_field else "Traditional"
+ )
func _on_outline_size_value_changed(value: float) -> void:
- %FontLabel.add_theme_constant_override("outline_size", int(value))
+ %FontLabel.add_theme_constant_override(&"outline_size", int(value))
%Value.text = str(value)
diff --git a/gui/multiple_resolutions/main.gd b/gui/multiple_resolutions/main.gd
index 529f7a12..c461b0fb 100644
--- a/gui/multiple_resolutions/main.gd
+++ b/gui/multiple_resolutions/main.gd
@@ -7,7 +7,7 @@ extends Control
var base_window_size := Vector2(
ProjectSettings.get_setting("display/window/size/viewport_width"),
ProjectSettings.get_setting("display/window/size/viewport_height")
-)
+ )
# These defaults match this demo's project settings. Adjust as needed if adapting this
# in your own project.
diff --git a/gui/theming_override/test.gd b/gui/theming_override/test.gd
index 3ba2181d..83ce9270 100644
--- a/gui/theming_override/test.gd
+++ b/gui/theming_override/test.gd
@@ -16,46 +16,46 @@ func _ready() -> void:
func _on_button_pressed() -> void:
- # We have to modify the normal, hover and pressed styleboxes all at once
+ # We have to modify the normal, hover, and pressed styleboxes all at once
# to get a correct appearance when the button is hovered or pressed.
# We can't use a single StyleBox for all of them as these have different
# background colors.
- var new_stylebox_normal: StyleBoxFlat = button.get_theme_stylebox("normal").duplicate()
+ var new_stylebox_normal: StyleBoxFlat = button.get_theme_stylebox(&"normal").duplicate()
new_stylebox_normal.border_color = Color(1, 1, 0)
- var new_stylebox_hover: StyleBoxFlat = button.get_theme_stylebox("hover").duplicate()
+ var new_stylebox_hover: StyleBoxFlat = button.get_theme_stylebox(&"hover").duplicate()
new_stylebox_hover.border_color = Color(1, 1, 0)
- var new_stylebox_pressed: StyleBoxFlat = button.get_theme_stylebox("pressed").duplicate()
+ var new_stylebox_pressed: StyleBoxFlat = button.get_theme_stylebox(&"pressed").duplicate()
new_stylebox_pressed.border_color = Color(1, 1, 0)
- button.add_theme_stylebox_override("normal", new_stylebox_normal)
- button.add_theme_stylebox_override("hover", new_stylebox_hover)
- button.add_theme_stylebox_override("pressed", new_stylebox_pressed)
+ button.add_theme_stylebox_override(&"normal", new_stylebox_normal)
+ button.add_theme_stylebox_override(&"hover", new_stylebox_hover)
+ button.add_theme_stylebox_override(&"pressed", new_stylebox_pressed)
- label.add_theme_color_override("font_color", Color(1, 1, 0.375))
+ label.add_theme_color_override(&"font_color", Color(1, 1, 0.375))
func _on_button2_pressed() -> void:
- var new_stylebox_normal: StyleBoxFlat = button2.get_theme_stylebox("normal").duplicate()
+ var new_stylebox_normal: StyleBoxFlat = button2.get_theme_stylebox(&"normal").duplicate()
new_stylebox_normal.border_color = Color(0, 1, 0.5)
- var new_stylebox_hover: StyleBoxFlat = button2.get_theme_stylebox("hover").duplicate()
+ var new_stylebox_hover: StyleBoxFlat = button2.get_theme_stylebox(&"hover").duplicate()
new_stylebox_hover.border_color = Color(0, 1, 0.5)
- var new_stylebox_pressed: StyleBoxFlat = button2.get_theme_stylebox("pressed").duplicate()
+ var new_stylebox_pressed: StyleBoxFlat = button2.get_theme_stylebox(&"pressed").duplicate()
new_stylebox_pressed.border_color = Color(0, 1, 0.5)
- button2.add_theme_stylebox_override("normal", new_stylebox_normal)
- button2.add_theme_stylebox_override("hover", new_stylebox_hover)
- button2.add_theme_stylebox_override("pressed", new_stylebox_pressed)
+ button2.add_theme_stylebox_override(&"normal", new_stylebox_normal)
+ button2.add_theme_stylebox_override(&"hover", new_stylebox_hover)
+ button2.add_theme_stylebox_override(&"pressed", new_stylebox_pressed)
- label.add_theme_color_override("font_color", Color(0.375, 1, 0.75))
+ label.add_theme_color_override(&"font_color", Color(0.375, 1, 0.75))
func _on_reset_all_button_pressed() -> void:
- button.remove_theme_stylebox_override("normal")
- button.remove_theme_stylebox_override("hover")
- button.remove_theme_stylebox_override("pressed")
+ button.remove_theme_stylebox_override(&"normal")
+ button.remove_theme_stylebox_override(&"hover")
+ button.remove_theme_stylebox_override(&"pressed")
- button2.remove_theme_stylebox_override("normal")
- button2.remove_theme_stylebox_override("hover")
- button2.remove_theme_stylebox_override("pressed")
+ button2.remove_theme_stylebox_override(&"normal")
+ button2.remove_theme_stylebox_override(&"hover")
+ button2.remove_theme_stylebox_override(&"pressed")
- label.remove_theme_color_override("font_color")
+ label.remove_theme_color_override(&"font_color")
diff --git a/gui/translation/translation_csv.gd b/gui/translation/translation_csv.gd
index e182af93..4325fa9f 100644
--- a/gui/translation/translation_csv.gd
+++ b/gui/translation/translation_csv.gd
@@ -38,7 +38,7 @@ func _print_intro() -> void:
# In CSV translation, use the appropriate key in the Object.tr() function to fetch
# the corresponding translation.
# This is the same for scene nodes containing user-facing texts to be translated.
- print(tr("KEY_INTRO"))
+ print(tr(&"KEY_INTRO"))
# CSV does not support plural translations. If you need pluralization, you must use PO instead.
diff --git a/gui/translation/translation_po.gd b/gui/translation/translation_po.gd
index 921cbf5f..596c265b 100644
--- a/gui/translation/translation_po.gd
+++ b/gui/translation/translation_po.gd
@@ -32,13 +32,13 @@ func _print_intro() -> void:
# In PO translation, you would use source string as the 'key' for the Object.tr() function.
# This is the same for scene nodes containing user-facing texts to be translated.
- print(tr("Hello, this is a translation demo project."))
+ print(tr(&"Hello, this is a translation demo project."))
# PO plural translation example.
# The difference with CSV is that you must add the "plural_message" argument, because PO files
# expect the data (else undefine behaviour might occur).
var days_passed := randi_range(1, 3)
- print(tr_n("One day ago.", "{days} days ago.", days_passed).format({ days = days_passed }))
+ print(tr_n(&"One day ago.", &"{days} days ago.", days_passed).format({ days = days_passed }))
func _on_go_to_csv_translation_demo_pressed() -> void:
diff --git a/loading/runtime_save_load/README.md b/loading/runtime_save_load/README.md
index 1800dcc8..44b4b6f9 100644
--- a/loading/runtime_save_load/README.md
+++ b/loading/runtime_save_load/README.md
@@ -3,7 +3,7 @@
This project showcases how to load and save various file types without going
through Godot's resource importing system.
-This is useful to load/save images, sounds, 3D scenes and ZIP archives at
+This is useful to load/save images, sounds, 3D scenes, and ZIP archives at
run-time such as user-generated content, without requiring users to generate a
PCK file through Godot.
diff --git a/loading/runtime_save_load/runtime_save_load.gd b/loading/runtime_save_load/runtime_save_load.gd
index c817f204..f904e127 100644
--- a/loading/runtime_save_load/runtime_save_load.gd
+++ b/loading/runtime_save_load/runtime_save_load.gd
@@ -73,7 +73,7 @@ func _on_scene_viewer_zoom_value_changed(value: float) -> void:
func _on_zip_viewer_item_selected(index: int) -> void:
zip_viewer_file_preview.text = zip_reader.read_file(
zip_viewer_file_list.get_item_text(index)
- ).get_string_from_utf8()
+ ).get_string_from_utf8()
#region File exporting
@@ -234,7 +234,7 @@ func open_file(path: String) -> void:
font_file.load_dynamic_font(path)
if not font_file.data.is_empty():
- font_viewer.add_theme_font_override("font", font_file)
+ font_viewer.add_theme_font_override(&"font", font_file)
reset_visibility()
font_viewer.visible = true
export_button.disabled = true
@@ -248,7 +248,7 @@ func open_file(path: String) -> void:
#
# Use `ProjectSettings.load_resource_pack()` to load PCK or ZIP files exported by Godot as
# additional data packs. That approach is preferred for DLCs, as it makes interacting with
- # additional data packs seamless (virtual filesystem).
+ # additional data packs seamlessly (virtual filesystem).
zip_reader.open(path)
var files := zip_reader.get_files()
files.sort()
diff --git a/loading/serialization/save_load_config_file.gd b/loading/serialization/save_load_config_file.gd
index a2cf93ec..9e884e84 100644
--- a/loading/serialization/save_load_config_file.gd
+++ b/loading/serialization/save_load_config_file.gd
@@ -42,7 +42,7 @@ func load_game() -> void:
player.sprite.rotation = config.get_value("player", "rotation")
# Remove existing enemies before adding new ones.
- get_tree().call_group("enemy", "queue_free")
+ get_tree().call_group(&"enemy", &"queue_free")
var enemies: Array = config.get_value("enemies", "enemies")
var game := get_node(game_node)
diff --git a/loading/serialization/save_load_json.gd b/loading/serialization/save_load_json.gd
index 13adb829..66acc297 100644
--- a/loading/serialization/save_load_json.gd
+++ b/loading/serialization/save_load_json.gd
@@ -51,7 +51,7 @@ func load_game() -> void:
player.sprite.rotation = str_to_var(save_dict.player.rotation)
# Remove existing enemies before adding new ones.
- get_tree().call_group("enemy", "queue_free")
+ get_tree().call_group(&"enemy", &"queue_free")
# Ensure the node structure is the same when loading.
var game := get_node(game_node)
diff --git a/misc/2.5d/addons/node25d/main_screen/viewport_25d.gd b/misc/2.5d/addons/node25d/main_screen/viewport_25d.gd
index ec73e89b..46f8208d 100644
--- a/misc/2.5d/addons/node25d/main_screen/viewport_25d.gd
+++ b/misc/2.5d/addons/node25d/main_screen/viewport_25d.gd
@@ -135,7 +135,7 @@ func _recursive_change_view_mode(current_node: Node) -> void:
if not current_node:
return
- if current_node.has_method("set_view_mode"):
+ if current_node.has_method(&"set_view_mode"):
current_node.set_view_mode(view_mode_index)
for child in current_node.get_children():
diff --git a/misc/custom_logging/custom_logger_ui.gd b/misc/custom_logging/custom_logger_ui.gd
index 178511cf..955a0e04 100644
--- a/misc/custom_logging/custom_logger_ui.gd
+++ b/misc/custom_logging/custom_logger_ui.gd
@@ -9,7 +9,7 @@ var logger := CustomLogger.new()
# called successfully otherwise.
class CustomLogger extends Logger:
func _log_message(message: String, _error: bool) -> void:
- CustomLoggerUI.get_node("Panel/RichTextLabel").call_deferred(&"append_text", message)
+ CustomLoggerUI.get_node(^"Panel/RichTextLabel").call_deferred(&"append_text", message)
func _log_error(
@@ -46,16 +46,16 @@ class CustomLogger extends Logger:
for backtrace in script_backtraces:
script_backtraces_text += backtrace.format(trace_indent - 3) + "\n"
- CustomLoggerUI.get_node("Panel/RichTextLabel").call_deferred(
+ CustomLoggerUI.get_node(^"Panel/RichTextLabel").call_deferred(
&"append_text",
"%s %s %s[/color]\n[color=#999]%s[/color]\n[color=#999]%s[/color]" % [
- prefix,
- code,
- rationale,
- trace,
- script_backtraces_text,
- ]
- )
+ prefix,
+ code,
+ rationale,
+ trace,
+ script_backtraces_text,
+ ]
+ )
# Use `_init()` to register the logger as early as possible, which ensures that messages
diff --git a/misc/custom_logging/main.gd b/misc/custom_logging/main.gd
index 4adafea3..b515bbe8 100644
--- a/misc/custom_logging/main.gd
+++ b/misc/custom_logging/main.gd
@@ -19,7 +19,7 @@ func _ready() -> void:
printraw("Normal message 1 (raw). ")
printraw("Normal message 2 (raw).\n--------\n")
- if bool(ProjectSettings.get_setting_with_override("application/run/flush_stdout_on_print")):
+ if bool(ProjectSettings.get_setting_with_override(&"application/run/flush_stdout_on_print")):
$FlushStdoutOnPrint.text = "Flush stdout on print: Yes (?)"
else:
$FlushStdoutOnPrint.text = "Flush stdout on print: No (?)"
@@ -51,7 +51,7 @@ func _on_print_error_pressed() -> void:
func _on_open_logs_folder_pressed() -> void:
- OS.shell_open(ProjectSettings.globalize_path(String(ProjectSettings.get_setting_with_override("debug/file_logging/log_path")).get_base_dir()))
+ OS.shell_open(ProjectSettings.globalize_path(String(ProjectSettings.get_setting_with_override(&"debug/file_logging/log_path")).get_base_dir()))
func _on_crash_engine_pressed() -> void:
diff --git a/misc/graphics_tablet_input/README.md b/misc/graphics_tablet_input/README.md
index d1fd626e..21dff3a1 100644
--- a/misc/graphics_tablet_input/README.md
+++ b/misc/graphics_tablet_input/README.md
@@ -8,7 +8,7 @@ may not support reporting tilt.
Input accumulation and V-Sync are disabled by default in this demo to minimize
input lag and get crisp lines (even at low FPS). This makes for the most
responsive drawing experience possible. You can toggle them in the sidebar to
-see the difference it makes. Note that on Android, iOS and Web platforms, V-Sync
+see the difference it makes. Note that on Android, iOS, and Web platforms, V-Sync
is forced at a system level and cannot be disabled.
Lines are drawn using the Line2D node. Every time you lift off the open and start a new
diff --git a/misc/graphics_tablet_input/graphics_tablet_input.gd b/misc/graphics_tablet_input/graphics_tablet_input.gd
index c24523b9..e10318ca 100644
--- a/misc/graphics_tablet_input/graphics_tablet_input.gd
+++ b/misc/graphics_tablet_input/graphics_tablet_input.gd
@@ -50,10 +50,10 @@ func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
var event_mouse_motion := event as InputEventMouseMotion
tablet_info.text = "Pressure: %.3f\nTilt: %.3v\nInverted pen: %s" % [
- event_mouse_motion.pressure,
- event_mouse_motion.tilt,
- "Yes" if event_mouse_motion.pen_inverted else "No",
- ]
+ event_mouse_motion.pressure,
+ event_mouse_motion.tilt,
+ "Yes" if event_mouse_motion.pen_inverted else "No",
+ ]
if event_mouse_motion.pressure <= 0 and stroke.points.size() > 1:
# Initial part of a stroke; create a new line.
@@ -61,6 +61,7 @@ func _input(event: InputEvent) -> void:
# Enable the buttons if they were previously disabled.
%ClearAllLines.disabled = false
%UndoLastLine.disabled = false
+
if event_mouse_motion.pressure > 0:
# Continue existing line.
stroke.add_point(event_mouse_motion.position)
@@ -73,7 +74,7 @@ func _input(event: InputEvent) -> void:
width_curve.add_point(Vector2(
float(pressure_idx) / pressures.size(),
pressures[pressure_idx]
- ))
+ ))
# Split into a new line if it gets too long to avoid performance issues.
# This is mostly reached when input accumulation is disabled, as enabling
@@ -175,7 +176,7 @@ func _on_msaa_item_selected(index: int) -> void:
func _on_max_fps_value_changed(value: float) -> void:
# Since the project has low-processor usage mode enabled, we change its sleep interval instead.
- # Since this is a value in microseconds between frames, we have to convert it from a FPS value.
+ # Since this is a value in microseconds between frames, we have to convert it from an FPS value.
@warning_ignore("narrowing_conversion")
OS.low_processor_usage_mode_sleep_usec = 1_000_000.0 / value
$CanvasLayer/PanelContainer/Options/MaxFPS/Value.text = str(roundi(value))
diff --git a/misc/graphics_tablet_input/graphics_tablet_input.tscn b/misc/graphics_tablet_input/graphics_tablet_input.tscn
index 66acc563..1c248216 100644
--- a/misc/graphics_tablet_input/graphics_tablet_input.tscn
+++ b/misc/graphics_tablet_input/graphics_tablet_input.tscn
@@ -186,14 +186,14 @@ horizontal_alignment = 1
layout_mode = 2
tooltip_text = "Disable V-Sync to achieve lower input latency.
-Note that Android, iOS and Web platforms enforce
+Note that Android, iOS, and Web platforms enforce
V-Sync at a system level with no reliable way to disable it."
text = "V-Sync"
[node name="InputAccumulation" type="CheckButton" parent="CanvasLayer/PanelContainer/Options"]
layout_mode = 2
tooltip_text = "If enabled, inputs are collected and merged into a single input event on every rendered frame.
-By default, this is enabled in Godot, but this project disables it by default.
+Usually this is enabled in Godot, but this project disables it by default.
This should be left disabled for drawing apps that expect precise input,
as lines can become visibly jagged otherwise."
diff --git a/misc/joypads/joypads.gd b/misc/joypads/joypads.gd
index 71a9e18b..cfdcd937 100644
--- a/misc/joypads/joypads.gd
+++ b/misc/joypads/joypads.gd
@@ -72,18 +72,18 @@ func _process(_delta: float) -> void:
joypad_axes.get_node(str(axis)).self_modulate.a = scaled_alpha_value
# Highlight axis labels that are within the "active" value range. Similar to the button highlighting for loop below.
- axes.get_node("Axis" + str(axis) + "/Label").add_theme_color_override("font_color", FONT_COLOR_DEFAULT)
+ axes.get_node("Axis" + str(axis) + "/Label").add_theme_color_override(&"font_color", FONT_COLOR_DEFAULT)
if abs(axis_value) >= DEADZONE:
- axes.get_node("Axis" + str(axis) + "/Label").add_theme_color_override("font_color", FONT_COLOR_ACTIVE)
+ axes.get_node("Axis" + str(axis) + "/Label").add_theme_color_override(&"font_color", FONT_COLOR_ACTIVE)
# Loop through the buttons and highlight the ones that are pressed.
for button in range(int(min(JOY_BUTTON_SDL_MAX, 21))):
if Input.is_joy_button_pressed(joy_num, button):
- button_grid.get_child(button).add_theme_color_override("font_color", FONT_COLOR_ACTIVE)
+ button_grid.get_child(button).add_theme_color_override(&"font_color", FONT_COLOR_ACTIVE)
if button <= JOY_BUTTON_MISC1:
joypad_buttons.get_child(button).show()
else:
- button_grid.get_child(button).add_theme_color_override("font_color", FONT_COLOR_DEFAULT)
+ button_grid.get_child(button).add_theme_color_override(&"font_color", FONT_COLOR_DEFAULT)
if button <= JOY_BUTTON_MISC1:
joypad_buttons.get_child(button).hide()
@@ -143,6 +143,7 @@ func set_joypad_name(joy_name: String, joy_guid: String) -> void:
for node: CanvasItem in [$JoypadDiagram, $Axes, $Buttons, $Vibration, $VBoxContainer]:
node.modulate.a = 1.0
+
func clear_joypad_name() -> void:
joypad_name.set_text("[i]No controller detected at ID %d.[/i]" % joypad_number.value)
diff --git a/misc/large_world_coordinates/controls.gd b/misc/large_world_coordinates/controls.gd
index 6f18fc12..c526c38f 100644
--- a/misc/large_world_coordinates/controls.gd
+++ b/misc/large_world_coordinates/controls.gd
@@ -17,7 +17,7 @@ const MAIN_BUTTONS = MOUSE_BUTTON_MASK_LEFT | MOUSE_BUTTON_MASK_MIDDLE | MOUSE_B
func _ready() -> void:
if OS.has_feature("double"):
%HelpLabel.text = "Double precision is enabled in this engine build.\nNo shaking should occur at high coordinate levels\n(±65,536 or more on any axis)."
- %HelpLabel.add_theme_color_override("font_color", Color(0.667, 1, 0.667))
+ %HelpLabel.add_theme_color_override(&"font_color", Color(0.667, 1, 0.667))
func _process(delta: float) -> void:
diff --git a/misc/matrix_transform/README.md b/misc/matrix_transform/README.md
index c9b11f9b..58b6a651 100644
--- a/misc/matrix_transform/README.md
+++ b/misc/matrix_transform/README.md
@@ -14,7 +14,7 @@ Check out this demo on the asset library: https://godotengine.org/asset-library/
## How does it work?
-In both 2D and 3D, colored lines are drawn indicating the basis vectors as well as the origin vector. For 3D, this means cuboids. If you translate, rotate, scale, or shear the AxisMarker objects, you will be able to see how it affects the transform's component vectors, and all children objects are also appropriately transformed.
+In both 2D and 3D, colored lines are drawn indicating the basis vectors as well as the origin vector. For 3D, this means cuboids. If you translate, rotate, scale, or shear the AxisMarker objects, you will be able to see how it affects the transform's component vectors, and all child objects are also appropriately transformed.
You are encouraged to manipulate the AxisMarker objects both in the main viewport and in the inspector. You are encouraged to duplicate them in the hierarchy and parent them any way you wish.
diff --git a/misc/multiple_windows/README.md b/misc/multiple_windows/README.md
index e8d682ed..d7278867 100644
--- a/misc/multiple_windows/README.md
+++ b/misc/multiple_windows/README.md
@@ -8,7 +8,7 @@ It includes:
- Adding physical objects to new windows.
- Showcase of all Dialog Windows.
- Showcase of all Popup Windows.
-- Adding elements to a Popup Menu.
+- Adding elements to a PopupMenu.
- Adding an icon to the system tray.
Language: GDScript
diff --git a/misc/multiple_windows/scenes/accept_dialogue/accept_dialog.tscn b/misc/multiple_windows/scenes/accept_dialog/accept_dialog.tscn
similarity index 100%
rename from misc/multiple_windows/scenes/accept_dialogue/accept_dialog.tscn
rename to misc/multiple_windows/scenes/accept_dialog/accept_dialog.tscn
diff --git a/misc/multiple_windows/scenes/confimation_dialogue/confirmation_dialog.tscn b/misc/multiple_windows/scenes/confirmation_dialog/confirmation_dialog.tscn
similarity index 100%
rename from misc/multiple_windows/scenes/confimation_dialogue/confirmation_dialog.tscn
rename to misc/multiple_windows/scenes/confirmation_dialog/confirmation_dialog.tscn
diff --git a/misc/multiple_windows/scenes/draggable_window/sprite_polygon_passthrough.gd b/misc/multiple_windows/scenes/draggable_window/sprite_polygon_passthrough.gd
index cb3ed80e..ea1c039c 100644
--- a/misc/multiple_windows/scenes/draggable_window/sprite_polygon_passthrough.gd
+++ b/misc/multiple_windows/scenes/draggable_window/sprite_polygon_passthrough.gd
@@ -1,7 +1,9 @@
extends Node
+
@export var sprite: Sprite2D
+
func generate_polygon():
# Make a bitmap out of a sprite.
var bitmap := BitMap.new()
diff --git a/misc/multiple_windows/scenes/file_dialogue/file_dialog.tscn b/misc/multiple_windows/scenes/file_dialog/file_dialog.tscn
similarity index 100%
rename from misc/multiple_windows/scenes/file_dialogue/file_dialog.tscn
rename to misc/multiple_windows/scenes/file_dialog/file_dialog.tscn
diff --git a/misc/multiple_windows/scenes/main_scene.gd b/misc/multiple_windows/scenes/main_scene.gd
index fa4f093b..b85113ab 100644
--- a/misc/multiple_windows/scenes/main_scene.gd
+++ b/misc/multiple_windows/scenes/main_scene.gd
@@ -75,7 +75,7 @@ func _on_draggable_window_close_pressed() -> void:
func _on_bg_draggable_window_toggled(toggled_on: bool) -> void:
- draggable_window.get_node("BG").visible = toggled_on
+ draggable_window.get_node(^"BG").visible = toggled_on
func _on_passthrough_polygon_item_selected(index: int) -> void:
@@ -83,7 +83,7 @@ func _on_passthrough_polygon_item_selected(index: int) -> void:
0:
draggable_window.mouse_passthrough_polygon = []
1:
- draggable_window.get_node("PassthroughGenerator").generate_polygon()
+ draggable_window.get_node(^"PassthroughGenerator").generate_polygon()
2:
draggable_window.mouse_passthrough_polygon = [
Vector2(16, 0), Vector2(16, 128),
@@ -119,6 +119,7 @@ func _on_file_dialog_options_item_selected(index: int) -> void:
4:
file_dialog.file_mode = FileDialog.FILE_MODE_SAVE_FILE
+
func _on_native_dialog_toggled(toggled_on: bool) -> void:
file_dialog.use_native_dialog = toggled_on
diff --git a/misc/multiple_windows/scenes/main_scene.tscn b/misc/multiple_windows/scenes/main_scene.tscn
index fa663559..ef3b6cca 100644
--- a/misc/multiple_windows/scenes/main_scene.tscn
+++ b/misc/multiple_windows/scenes/main_scene.tscn
@@ -5,9 +5,9 @@
[ext_resource type="Script" uid="uid://b4ngyw7e2c75u" path="res://scenes/disable_other.gd" id="2_psh0l"]
[ext_resource type="Script" uid="uid://evvrji8vwf5l" path="res://scenes/text_field.gd" id="3_bgndp"]
[ext_resource type="PackedScene" uid="uid://ek1fmwy87san" path="res://scenes/draggable_window/draggable_window.tscn" id="4_diw6b"]
-[ext_resource type="PackedScene" uid="uid://dx84v67isxyjv" path="res://scenes/file_dialogue/file_dialog.tscn" id="5_f4o8g"]
-[ext_resource type="PackedScene" uid="uid://cudrukovmha7p" path="res://scenes/accept_dialogue/accept_dialog.tscn" id="6_st8be"]
-[ext_resource type="PackedScene" uid="uid://1nswovajdv3n" path="res://scenes/confimation_dialogue/confirmation_dialog.tscn" id="7_wii4q"]
+[ext_resource type="PackedScene" uid="uid://dx84v67isxyjv" path="res://scenes/file_dialog/file_dialog.tscn" id="5_f4o8g"]
+[ext_resource type="PackedScene" uid="uid://cudrukovmha7p" path="res://scenes/accept_dialog/accept_dialog.tscn" id="6_st8be"]
+[ext_resource type="PackedScene" uid="uid://1nswovajdv3n" path="res://scenes/confirmation_dialog/confirmation_dialog.tscn" id="7_wii4q"]
[ext_resource type="PackedScene" uid="uid://p7lgllpnc8h8" path="res://scenes/popup/popup.tscn" id="8_vohc5"]
[ext_resource type="PackedScene" uid="uid://j7j6fe7plvmt" path="res://scenes/popup_menu/popup_menu.tscn" id="9_b1y32"]
[ext_resource type="PackedScene" uid="uid://dj15to28g17lb" path="res://scenes/popup_panel/popup_panel.tscn" id="10_rn47v"]
@@ -57,7 +57,7 @@ text = "Show window"
[node name="WindowTitleEdit" type="LineEdit" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2
-placeholder_text = "Window's Title"
+placeholder_text = "Window Title"
[node name="TransientWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer" node_paths=PackedStringArray("others")]
layout_mode = 2
@@ -69,13 +69,11 @@ others = [NodePath("../ExclusiveWindow")]
layout_mode = 2
tooltip_text = "Needs transient enabled to work."
disabled = true
-text = "Exclusive
-"
+text = "Exclusive"
[node name="UnresizableWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2
-text = "Unresizable
-"
+text = "Unresizable"
[node name="BorderlessWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2
@@ -88,8 +86,7 @@ text = "Always on Top"
[node name="TransparentWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2
tooltip_text = "Needs embed_subwindows disabled to work."
-text = "Transparent
-"
+text = "Transparent"
[node name="HSeparator2" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2
@@ -105,7 +102,7 @@ layout_mode = 2
[node name="DraggableWindowButton" type="Button" parent="HBoxContainer/VBoxContainer/HBoxContainerDW"]
layout_mode = 2
size_flags_horizontal = 3
-text = "Draggable window"
+text = "Draggable Window"
[node name="Close" type="Button" parent="HBoxContainer/VBoxContainer/HBoxContainerDW"]
layout_mode = 2
@@ -114,10 +111,9 @@ text = "X"
[node name="DraggableWindowExplanation" type="RichTextLabel" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/normal_font_size = 12
-text = "This window uses Area2D to detect if user clicked inside of it.
-Since it's Area2D, you can change it's CollisionShape2D.
-But since Area2D is a Physics Object, \"Physics Object Picking\" inside of Window's properties hard to be enabled.
-"
+text = "This window uses an Area2D to detect if the user clicked inside of it.
+Since it's an Area2D, you can change its CollisionShape2D.
+But since Area2D is a Physics Object, the \"Physics Object Picking\" property has to be enabled in Window."
fit_content = true
[node name="BGDraggableWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer"]
@@ -170,8 +166,7 @@ popup/item_4/id = 4
[node name="NativeDialog" type="CheckButton" parent="HBoxContainer/VBoxContainer2"]
layout_mode = 2
-text = "Use Native
-Dialog"
+text = "Use Native Dialog"
[node name="FileDialogOutput" type="TextEdit" parent="HBoxContainer/VBoxContainer2"]
custom_minimum_size = Vector2(200, 150)
@@ -209,7 +204,7 @@ text = "Enter"
[node name="AcceptOutput" type="TextEdit" parent="HBoxContainer/VBoxContainer2"]
custom_minimum_size = Vector2(200, 70)
layout_mode = 2
-placeholder_text = "Dialogue result will show up here."
+placeholder_text = "Dialog result will show up here."
editable = false
wrap_mode = 1
@@ -223,7 +218,7 @@ horizontal_alignment = 1
[node name="ConfirmationButton" type="Button" parent="HBoxContainer/VBoxContainer2"]
layout_mode = 2
-text = "Show Dialogue"
+text = "Show Dialog"
[node name="ConfirmationOutput" type="TextEdit" parent="HBoxContainer/VBoxContainer2"]
custom_minimum_size = Vector2(200, 35)
@@ -250,7 +245,7 @@ layout_mode = 2
theme_override_font_sizes/normal_font_size = 12
theme_override_font_sizes/mono_font_size = 12
bbcode_enabled = true
-text = "Popup hiding on mouse exit is handled by via [code]mouse_exited[/code] signal"
+text = "Popup hiding on mouse exit is handled by via the [code]mouse_exited[/code] signal."
fit_content = true
[node name="HSeparator" type="HSeparator" parent="HBoxContainer/VBoxContainer3"]
diff --git a/misc/multiple_windows/scenes/window/window.gd b/misc/multiple_windows/scenes/window/window.gd
index ceaee472..3896318d 100644
--- a/misc/multiple_windows/scenes/window/window.gd
+++ b/misc/multiple_windows/scenes/window/window.gd
@@ -7,5 +7,5 @@ func _ready() -> void:
func _on_close_requested() -> void:
- print("%s %s was hidden." % [str(self.get_class()), name])
+ print("%s %s was hidden." % [str(get_class()), name])
hide()
diff --git a/misc/noise_viewer/noise_viewer.gd b/misc/noise_viewer/noise_viewer.gd
index c150780e..6b715ae5 100644
--- a/misc/noise_viewer/noise_viewer.gd
+++ b/misc/noise_viewer/noise_viewer.gd
@@ -26,8 +26,8 @@ func _refresh_shader_params() -> void:
@warning_ignore("integer_division")
var _max := (max_noise + 1) / 2
var _material: ShaderMaterial = $SeamlessNoiseTexture.material
- _material.set_shader_parameter("min_value", _min)
- _material.set_shader_parameter("max_value", _max)
+ _material.set_shader_parameter(&"min_value", _min)
+ _material.set_shader_parameter(&"max_value", _max)
func _on_documentation_button_pressed() -> void:
diff --git a/misc/os_test/actions.gd b/misc/os_test/actions.gd
index 217db828..13679dcb 100644
--- a/misc/os_test/actions.gd
+++ b/misc/os_test/actions.gd
@@ -85,7 +85,7 @@ func _on_add_global_menu_items_pressed() -> void:
func(tag: String) -> void: print("Key main 1 " + str(tag)),
null,
(KEY_MASK_META | KEY_1) as Key
- )
+ )
DisplayServer.global_menu_add_separator("_main/Hello")
DisplayServer.global_menu_add_item("_main/Hello", "World2", func(tag: String) -> void: print("Clicked main 2 " + str(tag)))
diff --git a/misc/os_test/os_test.gd b/misc/os_test/os_test.gd
index 24f31da7..99ee69af 100644
--- a/misc/os_test/os_test.gd
+++ b/misc/os_test/os_test.gd
@@ -19,27 +19,27 @@ func datetime_to_string(date: Dictionary) -> void:
):
# Date and time.
return "{year}-{month}-{day} {hour}:{minute}:{second}".format({
- year = str(date.year).pad_zeros(2),
- month = str(date.month).pad_zeros(2),
- day = str(date.day).pad_zeros(2),
- hour = str(date.hour).pad_zeros(2),
- minute = str(date.minute).pad_zeros(2),
- second = str(date.second).pad_zeros(2),
- })
+ year = str(date.year).pad_zeros(2),
+ month = str(date.month).pad_zeros(2),
+ day = str(date.day).pad_zeros(2),
+ hour = str(date.hour).pad_zeros(2),
+ minute = str(date.minute).pad_zeros(2),
+ second = str(date.second).pad_zeros(2),
+ })
elif date.has("year") and date.has("month") and date.has("day"):
# Date only.
return "{year}-{month}-{day}".format({
- year = str(date.year).pad_zeros(2),
- month = str(date.month).pad_zeros(2),
- day = str(date.day).pad_zeros(2),
- })
+ year = str(date.year).pad_zeros(2),
+ month = str(date.month).pad_zeros(2),
+ day = str(date.day).pad_zeros(2),
+ })
else:
# Time only.
return "{hour}:{minute}:{second}".format({
- hour = str(date.hour).pad_zeros(2),
- minute = str(date.minute).pad_zeros(2),
- second = str(date.second).pad_zeros(2),
- })
+ hour = str(date.hour).pad_zeros(2),
+ minute = str(date.minute).pad_zeros(2),
+ second = str(date.second).pad_zeros(2),
+ })
func scan_midi_inputs() -> String:
@@ -55,13 +55,14 @@ func scan_midi_inputs() -> String:
func add_header(header: String) -> void:
rtl.append_text("\n[font_size=24][color=#5cf]{header}[/color][/font_size]\n[font_size=1]\n[/font_size]".format({
- header = header,
- }))
+ header = header,
+ }))
# Also print to the terminal for easy copy-pasting and headless usage.
print_rich("\n[b][u][color=blue]{header}[/color][/u][/b]\n".format({
- header = header,
- }))
+ header = header,
+ }))
+
func add_line(key: String, value: Variant) -> void:
line_count += 1
@@ -71,20 +72,20 @@ func add_line(key: String, value: Variant) -> void:
value = "[color=6f7]true[/color]" if original_value else "[color=#f76]false[/color]"
rtl.append_text("{bgcolor}[color=#9df]{key}:[/color] {value}{bgcolor_end}\n".format({
- key = key,
- value = value if str(value) != "" else "[color=#fff8](empty)[/color]",
- bgcolor = "[bgcolor=#8883]" if line_count % 2 == 0 else "",
- bgcolor_end = "[/bgcolor]" if line_count % 2 == 0 else "",
- }))
+ key = key,
+ value = value if str(value) != "" else "[color=#fff8](empty)[/color]",
+ bgcolor = "[bgcolor=#8883]" if line_count % 2 == 0 else "",
+ bgcolor_end = "[/bgcolor]" if line_count % 2 == 0 else "",
+ }))
if typeof(original_value) == TYPE_BOOL:
# Colorize boolean values (`print_rich()`-friendly version, using basic colors only).
value = "[color=green]true[/color]" if original_value else "[color=red]false[/color]"
# Also print to the terminal for easy copy-pasting and headless usage.
print_rich("[b][color=cyan]{key}:[/color][/b] {value}".format({
- key = key,
- value = value if str(value) != "" else "[code](empty)[/code]",
- }))
+ key = key,
+ value = value if str(value) != "" else "[code](empty)[/code]",
+ }))
func _ready() -> void:
@@ -118,14 +119,14 @@ func _ready() -> void:
add_line("Startup screen refresh rate", ("%f Hz" % DisplayServer.screen_get_refresh_rate()) if DisplayServer.screen_get_refresh_rate() > 0.0 else "")
add_line("Usable (safe) area rectangle", DisplayServer.get_display_safe_area())
add_line("Screen orientation", [
- "Landscape",
- "Portrait",
- "Landscape (reverse)",
- "Portrait (reverse)",
- "Landscape (defined by sensor)",
- "Portrait (defined by sensor)",
- "Defined by sensor",
- ][DisplayServer.screen_get_orientation()])
+ "Landscape",
+ "Portrait",
+ "Landscape (reverse)",
+ "Portrait (reverse)",
+ "Landscape (defined by sensor)",
+ "Portrait (defined by sensor)",
+ "Defined by sensor",
+ ][DisplayServer.screen_get_orientation()])
add_header("Engine")
add_line("Version", Engine.get_version_info()["string"])
@@ -214,16 +215,17 @@ func _ready() -> void:
if RenderingServer.get_current_rendering_method() != "gl_compatibility":
# Querying the adapter type isn't supported in Compatibility.
add_line("Adapter type", [
- "Other (Unknown)",
- "Integrated",
- "Discrete",
- "Virtual",
- "CPU",
- ][RenderingServer.get_video_adapter_type()])
+ "Other (Unknown)",
+ "Integrated",
+ "Discrete",
+ "Virtual",
+ "CPU",
+ ][RenderingServer.get_video_adapter_type()])
add_line("Adapter graphics API version", RenderingServer.get_video_adapter_api_version())
var video_adapter_driver_info := OS.get_video_adapter_driver_info()
if video_adapter_driver_info.size() > 0:
add_line("Adapter driver name", video_adapter_driver_info[0])
+
if video_adapter_driver_info.size() > 1:
add_line("Adapter driver version", video_adapter_driver_info[1])
diff --git a/misc/window_management/README.md b/misc/window_management/README.md
index d46df456..0753784d 100644
--- a/misc/window_management/README.md
+++ b/misc/window_management/README.md
@@ -8,7 +8,7 @@ A demo showing the various window management features available through
- Minimizing and maximizing.
- Moving the window around.
- Making the window transparent.
-- Capturing, hiding or confining the mouse.
+- Capturing, hiding, or confining the mouse.
- Getting various information about the screens, including DPI and refresh rate.
Language: GDScript
diff --git a/misc/window_management/control.gd b/misc/window_management/control.gd
index 724495a9..79b37f33 100644
--- a/misc/window_management/control.gd
+++ b/misc/window_management/control.gd
@@ -29,6 +29,7 @@ func _ready() -> void:
if DisplayServer.get_screen_count() > 1:
$Labels/Label_Screen1_RefreshRate.text = "Screen1 Refresh Rate: %.2f Hz" % DisplayServer.screen_get_refresh_rate(1)
+
func _physics_process(_delta: float) -> void:
var modetext := "Mode: "
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
@@ -111,40 +112,40 @@ func _input(event: InputEvent) -> void:
func check_wm_api() -> bool:
var s := ""
- if not DisplayServer.has_method("get_screen_count"):
+ if not DisplayServer.has_method(&"get_screen_count"):
s += " - get_screen_count()\n"
- if not DisplayServer.has_method("window_get_current_screen"):
+ if not DisplayServer.has_method(&"window_get_current_screen"):
s += " - window_get_current_screen()\n"
- if not DisplayServer.has_method("window_set_current_screen"):
+ if not DisplayServer.has_method(&"window_set_current_screen"):
s += " - window_set_current_screen()\n"
- if not DisplayServer.has_method("screen_get_position"):
+ if not DisplayServer.has_method(&"screen_get_position"):
s += " - screen_get_position()\n"
- if not DisplayServer.has_method("window_get_size"):
+ if not DisplayServer.has_method(&"window_get_size"):
s += " - window_get_size()\n"
- if not DisplayServer.has_method("window_get_position"):
+ if not DisplayServer.has_method(&"window_get_position"):
s += " - window_get_position()\n"
- if not DisplayServer.has_method("window_set_position"):
+ if not DisplayServer.has_method(&"window_set_position"):
s += " - window_set_position()\n"
- if not DisplayServer.has_method("window_get_size"):
+ if not DisplayServer.has_method(&"window_get_size"):
s += " - get_window_size()\n"
- if not DisplayServer.has_method("window_set_size"):
+ if not DisplayServer.has_method(&"window_set_size"):
s += " - window_set_size()\n"
# These function are no longer and this is set through flags!
-# if not DisplayServer.has_method("set_window_fullscreen"):
+# if not DisplayServer.has_method(&"set_window_fullscreen"):
# s += " - set_window_fullscreen()\n"
-# if not DisplayServer.window_get_flag() OS.has_method("is_window_fullscreen"):
+# if not DisplayServer.window_get_flag() OS.has_method(&"is_window_fullscreen"):
# s += " - is_window_fullscreen()\n"
-# if not OS.has_method("set_window_resizable"):
+# if not OS.has_method(&"set_window_resizable"):
# s += " - set_window_resizable()\n"
-# if not OS.has_method("is_window_resizable"):
+# if not OS.has_method(&"is_window_resizable"):
# s += " - is_window_resizable()\n"
-# if not OS.has_method("set_window_minimized"):
+# if not OS.has_method(&"set_window_minimized"):
# s += " - set_window_minimized()\n"
-# if not OS.has_method("is_window_minimized"):
+# if not OS.has_method(&"is_window_minimized"):
# s += " - is_window_minimized()\n"
-# if not OS.has_method("set_window_maximized"):
+# if not OS.has_method(&"set_window_maximized"):
# s += " - set_window_maximized()\n"
-# if not OS.has_method("is_window_maximized"):
+# if not OS.has_method(&"is_window_maximized"):
# s += " - is_window_maximized()\n"
if s.length() == 0:
@@ -211,6 +212,7 @@ func _on_button_mouse_mode_captured_pressed() -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
observer.state = observer.State.GRAB
+
func _on_button_mouse_mode_confined_pressed() -> void:
Input.mouse_mode = Input.MOUSE_MODE_CONFINED
diff --git a/misc/window_management/observer/observer.gd b/misc/window_management/observer/observer.gd
index 9f2520f9..aed0779c 100644
--- a/misc/window_management/observer/observer.gd
+++ b/misc/window_management/observer/observer.gd
@@ -36,7 +36,7 @@ func _input(event: InputEvent) -> void:
# Use `screen_relative` to make sensitivity independent of the viewport resolution.
r_pos = -event.screen_relative * MOUSE_SENSITIVITY
- if event.is_action("ui_cancel") and event.is_pressed() and not event.is_echo():
+ if event.is_action(&"ui_cancel") and event.is_pressed() and not event.is_echo():
if state == State.GRAB:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
state = State.MENU
diff --git a/misc/window_management/window_management.tscn b/misc/window_management/window_management.tscn
index 9b4ee7f8..f441f3cf 100644
--- a/misc/window_management/window_management.tscn
+++ b/misc/window_management/window_management.tscn
@@ -337,7 +337,7 @@ text = "This is an Implementation-Test-Demo
It is used to help implementing a new window handling api
across platforms.
-Your platform lacks at the moment the following methods:
+Your platform lacks the following methods at the moment:
"
[node name="CheckButton" type="CheckButton" parent="Control"]
diff --git a/mobile/android_iap/iap_demo.gd b/mobile/android_iap/iap_demo.gd
index 22454512..882e36d4 100644
--- a/mobile/android_iap/iap_demo.gd
+++ b/mobile/android_iap/iap_demo.gd
@@ -10,10 +10,10 @@ var test_item_purchase_token := ""
func _ready() -> void:
- if Engine.has_singleton("GodotGooglePlayBilling"):
+ if Engine.has_singleton(&"GodotGooglePlayBilling"):
label.text += "\n\n\nTest item SKU: %s" % TEST_ITEM_SKU
- payment = Engine.get_singleton("GodotGooglePlayBilling")
+ payment = Engine.get_singleton(&"GodotGooglePlayBilling")
# No params.
payment.connected.connect(_on_connected)
# No params.
diff --git a/mobile/multitouch_cubes/GestureArea.gd b/mobile/multitouch_cubes/GestureArea.gd
index 73acad23..a057f5a3 100644
--- a/mobile/multitouch_cubes/GestureArea.gd
+++ b/mobile/multitouch_cubes/GestureArea.gd
@@ -36,7 +36,7 @@ func _gui_input(event: InputEvent) -> void:
elif finger_count == 1:
# One finger => For rotating around X and Y.
- # Accept one more press, unpress or drag.
+ # Accept one more press, unpress, or drag.
if event is InputEventScreenTouch:
if event.pressed:
# One more finger started touching.
diff --git a/mono/2.5d/addons/node25d-cs/main_screen/viewport_25d.gd b/mono/2.5d/addons/node25d-cs/main_screen/viewport_25d.gd
index 405e2706..00c71a0e 100644
--- a/mono/2.5d/addons/node25d-cs/main_screen/viewport_25d.gd
+++ b/mono/2.5d/addons/node25d-cs/main_screen/viewport_25d.gd
@@ -70,23 +70,23 @@ func _process(delta):
for overlay_child in overlay_children:
var contains = false
for selected in selection:
- if selected == overlay_child.get("node25d") and not view_mode_changed_this_frame:
+ if selected == overlay_child.get(&"node25d") and not view_mode_changed_this_frame:
contains = true
if not contains:
overlay_child.queue_free()
# Add new gizmos.
for selected in selection:
- if selected.has_method("Node25DReady"):
+ if selected.has_method(&"Node25DReady"):
var new = true
for overlay_child in overlay_children:
- if selected == overlay_child.get("node25d"):
+ if selected == overlay_child.get(&"node25d"):
new = false
if new:
var gizmo = gizmo_25d_scene.instantiate()
viewport_overlay.add_child(gizmo)
- gizmo.set("node25d", selected)
- gizmo.call("Initialize")
+ gizmo.set(&"node25d", selected)
+ gizmo.call(&"Initialize")
# This only accepts input when the mouse is inside of the 2.5D viewport.
@@ -106,7 +106,7 @@ func _gui_input(event):
elif event.button_index == MOUSE_BUTTON_LEFT:
var overlay_children = viewport_overlay.get_children()
for overlay_child in overlay_children:
- overlay_child.set("wantsToMove", true)
+ overlay_child.set(&"wantsToMove", true)
accept_event()
elif event.button_index == MOUSE_BUTTON_MIDDLE:
is_panning = false
@@ -114,7 +114,7 @@ func _gui_input(event):
elif event.button_index == MOUSE_BUTTON_LEFT:
var overlay_children = viewport_overlay.get_children()
for overlay_child in overlay_children:
- overlay_child.set("wantsToMove", false)
+ overlay_child.set(&"wantsToMove", false)
accept_event()
elif event is InputEventMouseMotion:
if is_panning:
@@ -123,10 +123,10 @@ func _gui_input(event):
func _recursive_change_view_mode(current_node):
- if current_node.has_method("set_view_mode"):
+ if current_node.has_method(&"set_view_mode"):
current_node.set_view_mode(view_mode_index) # GDScript.
- if current_node.has_method("SetViewMode"):
- current_node.call("SetViewMode", view_mode_index) # C#.
+ if current_node.has_method(&"SetViewMode"):
+ current_node.call(&"SetViewMode", view_mode_index) # C#.
for child in current_node.get_children():
_recursive_change_view_mode(child)
diff --git a/networking/multiplayer_bomber/bomb.gd b/networking/multiplayer_bomber/bomb.gd
index 5a0959ee..04dfd086 100644
--- a/networking/multiplayer_bomber/bomb.gd
+++ b/networking/multiplayer_bomber/bomb.gd
@@ -10,7 +10,7 @@ func explode() -> void:
return
for p: Object in in_area:
- if p.has_method("exploded"):
+ if p.has_method(&"exploded"):
# Checks if there is wall in between bomb and the object.
var world_state: PhysicsDirectSpaceState2D = get_world_2d().direct_space_state
var query := PhysicsRayQueryParameters2D.create(position, p.position)
diff --git a/networking/multiplayer_bomber/gamestate.gd b/networking/multiplayer_bomber/gamestate.gd
index 72ed3459..891f9c57 100644
--- a/networking/multiplayer_bomber/gamestate.gd
+++ b/networking/multiplayer_bomber/gamestate.gd
@@ -32,7 +32,7 @@ func _player_connected(id: int) -> void:
# Callback from SceneTree.
func _player_disconnected(id: int) -> void:
- if has_node("/root/World"):
+ if has_node(^"/root/World"):
# Game is in progress.
if multiplayer.is_server():
game_error.emit("Player " + players[id] + " disconnected")
@@ -79,12 +79,12 @@ func load_world() -> void:
# Change scene.
var world: Node2D = load("res://world.tscn").instantiate()
get_tree().get_root().add_child(world)
- get_tree().get_root().get_node("Lobby").hide()
+ get_tree().get_root().get_node(^"Lobby").hide()
# Set up score.
- world.get_node("Score").add_player(multiplayer.get_unique_id(), player_name)
+ world.get_node(^"Score").add_player(multiplayer.get_unique_id(), player_name)
for pn: int in players:
- world.get_node("Score").add_player(pn, players[pn])
+ world.get_node(^"Score").add_player(pn, players[pn])
# Unpause and unleash the game!
get_tree().paused = false
@@ -112,7 +112,7 @@ func begin_game() -> void:
assert(multiplayer.is_server())
load_world.rpc()
- var world: Node2D = get_tree().get_root().get_node("World")
+ var world: Node2D = get_tree().get_root().get_node(^"World")
var player_scene: PackedScene = load("res://player.tscn")
# Create a dictionary with peer ID. and respective spawn points.
@@ -129,15 +129,15 @@ func begin_game() -> void:
var player := player_scene.instantiate()
player.synced_position = spawn_pos
player.name = str(p_id)
- world.get_node("Players").add_child(player)
+ world.get_node(^"Players").add_child(player)
# The RPC must be called after the player is added to the scene tree.
player.set_player_name.rpc(player_name if p_id == multiplayer.get_unique_id() else players[p_id])
func end_game() -> void:
- if has_node("/root/World"):
+ if has_node(^"/root/World"):
# If the game is in progress, end it.
- get_node("/root/World").queue_free()
+ get_node(^"/root/World").queue_free()
game_ended.emit()
players.clear()
diff --git a/networking/multiplayer_bomber/player.gd b/networking/multiplayer_bomber/player.gd
index cd4e3fae..9e333d12 100644
--- a/networking/multiplayer_bomber/player.gd
+++ b/networking/multiplayer_bomber/player.gd
@@ -78,4 +78,4 @@ func exploded(_by_who: int) -> void:
return
stunned = true
- $anim.play("stunned")
+ $anim.play(&"stunned")
diff --git a/networking/multiplayer_bomber/rock.gd b/networking/multiplayer_bomber/rock.gd
index 9dad5efc..6ae1805f 100644
--- a/networking/multiplayer_bomber/rock.gd
+++ b/networking/multiplayer_bomber/rock.gd
@@ -3,4 +3,4 @@ extends CharacterBody2D
@rpc("call_local")
func exploded(by_who: int) -> void:
$"../../Score".increase_score(by_who)
- $"AnimationPlayer".play("explode")
+ $"AnimationPlayer".play(&"explode")
diff --git a/networking/multiplayer_bomber/score.gd b/networking/multiplayer_bomber/score.gd
index 348389ea..90ea4cbc 100644
--- a/networking/multiplayer_bomber/score.gd
+++ b/networking/multiplayer_bomber/score.gd
@@ -30,10 +30,10 @@ func add_player(id: int, new_player_name: String) -> void:
label.text = new_player_name + "\n" + "0"
label.modulate = gamestate.get_player_color(new_player_name)
label.size_flags_horizontal = SIZE_EXPAND_FILL
- label.add_theme_font_override("font", preload("res://montserrat.otf"))
- label.add_theme_color_override("font_outline_color", Color.BLACK)
- label.add_theme_constant_override("outline_size", 9)
- label.add_theme_font_size_override("font_size", 18)
+ label.add_theme_font_override(&"font", preload("res://montserrat.otf"))
+ label.add_theme_color_override(&"font_outline_color", Color.BLACK)
+ label.add_theme_constant_override(&"outline_size", 9)
+ label.add_theme_font_size_override(&"font_size", 18)
add_child(label)
player_labels[id] = {
diff --git a/networking/multiplayer_pong/logic/lobby.gd b/networking/multiplayer_pong/logic/lobby.gd
index 4957bb09..eb9a55c8 100644
--- a/networking/multiplayer_pong/logic/lobby.gd
+++ b/networking/multiplayer_pong/logic/lobby.gd
@@ -62,7 +62,7 @@ func _server_disconnected() -> void:
#region Game creation methods
func _end_game(with_error: String = "") -> void:
- if has_node("/root/Pong"):
+ if has_node(^"/root/Pong"):
# Erase immediately, otherwise network might show
# errors (this is why we connected deferred above).
get_node(^"/root/Pong").free()
diff --git a/networking/webrtc_minimal/main.gd b/networking/webrtc_minimal/main.gd
index 6b0b9490..64375175 100644
--- a/networking/webrtc_minimal/main.gd
+++ b/networking/webrtc_minimal/main.gd
@@ -8,10 +8,10 @@ func _ready() -> void:
add_child(p1)
add_child(p2)
- # Wait a second and send message from P1.
+ # Wait one second and send message from P1.
await get_tree().create_timer(1.0).timeout
p1.send_message("Hi from %s" % String(p1.get_path()))
- # Wait a second and send message from P2.
+ # Wait one second and send message from P2.
await get_tree().create_timer(1.0).timeout
p2.send_message("Hi from %s" % String(p2.get_path()))
diff --git a/networking/webrtc_minimal/minimal.gd b/networking/webrtc_minimal/minimal.gd
index e573d44b..dc3c047e 100644
--- a/networking/webrtc_minimal/minimal.gd
+++ b/networking/webrtc_minimal/minimal.gd
@@ -23,11 +23,11 @@ func _ready() -> void:
# Let P1 create the offer.
p1.create_offer()
- # Wait a second and send message from P1.
+ # Wait one second and send message from P1.
await get_tree().create_timer(1).timeout
ch1.put_packet("Hi from P1".to_utf8_buffer())
- # Wait a second and send message from P2.
+ # Wait one second and send message from P2.
await get_tree().create_timer(1).timeout
ch2.put_packet("Hi from P2".to_utf8_buffer())
diff --git a/networking/webrtc_signaling/demo/main.gd b/networking/webrtc_signaling/demo/main.gd
index 6727d8e5..db6a3b3f 100644
--- a/networking/webrtc_signaling/demo/main.gd
+++ b/networking/webrtc_signaling/demo/main.gd
@@ -6,7 +6,7 @@ func _enter_tree() -> void:
get_tree().set_multiplayer(
MultiplayerAPI.create_default_interface(),
NodePath("%s/VBoxContainer/Clients/%s" % [get_path(), c.name])
- )
+ )
func _ready() -> void:
diff --git a/plugins/addons/main_screen/main_screen_plugin.gd b/plugins/addons/main_screen/main_screen_plugin.gd
index 5e5ad451..58921a2c 100644
--- a/plugins/addons/main_screen/main_screen_plugin.gd
+++ b/plugins/addons/main_screen/main_screen_plugin.gd
@@ -38,4 +38,4 @@ func _get_plugin_name() -> String:
func _get_plugin_icon() -> Texture2D:
- return get_editor_interface().get_base_control().get_theme_icon("Node", "EditorIcons")
+ return get_editor_interface().get_base_control().get_theme_icon(&"Node", &"EditorIcons")
diff --git a/plugins/addons/material_creator/README.md b/plugins/addons/material_creator/README.md
index 6518a71a..7a94f0f3 100644
--- a/plugins/addons/material_creator/README.md
+++ b/plugins/addons/material_creator/README.md
@@ -9,7 +9,7 @@ For more information, see this documentation article:
https://docs.godotengine.org/en/latest/tutorials/plugins/editor/making_plugins.html#a-custom-dock
## Features
-- Adjust albedo color, metallic and rouphness values interactively.
+- Adjust albedo color, metallic, and rouphness values interactively.
- Apply the generated material to selected 3D nodes in the editor.
- Save and load materials in two ways:
- `.silly_mat`: Custom Godot Resource type, handled by custom saver/loader
diff --git a/plugins/addons/material_creator/material_creator.gd b/plugins/addons/material_creator/material_creator.gd
index 43b7e4dd..881c8f28 100644
--- a/plugins/addons/material_creator/material_creator.gd
+++ b/plugins/addons/material_creator/material_creator.gd
@@ -17,18 +17,18 @@ func _ready() -> void:
$SaveMaterialDialog.current_dir = "res://materials"
$SaveMaterialDialog.current_file = "new_material.silly_mat"
$SaveMaterialDialog.filters = PackedStringArray([
- "*.silly_mat ; Silly Material (resource)",
- "*.tres ; Godot Resource (resource)",
- "*.mtxt ; Silly Material (source)"
- ])
+ "*.silly_mat ; Silly Material (resource)",
+ "*.tres ; Godot Resource (resource)",
+ "*.mtxt ; Silly Material (source)",
+ ])
$SaveMaterialDialog.confirmed.connect(_on_save_confirmed)
$LoadMaterialDialog.access = FileDialog.ACCESS_RESOURCES
$LoadMaterialDialog.filters = PackedStringArray([
- "*.silly_mat ; Silly Material (resource)",
- "*.tres ; Godot Resource (resource)",
- "*.mtxt ; Silly Material (source)"
- ])
+ "*.silly_mat ; Silly Material (resource)",
+ "*.tres ; Godot Resource (resource)",
+ "*.mtxt ; Silly Material (source)",
+ ])
$LoadMaterialDialog.file_selected.connect(load_file_selected)
RenderingServer.canvas_item_set_clip(get_canvas_item(), true)
@@ -59,7 +59,7 @@ func _on_save_confirmed() -> void:
if path.begins_with("res://") and not DirAccess.dir_exists_absolute(dir):
var mk := DirAccess.make_dir_recursive_absolute(dir)
if mk != OK:
- push_error("Material Creator: Can't create folder: %s (%s)" % [dir, error_string(mk)])
+ push_error("Material Creator: Can't create folder: \"%s\" (%s)." % [dir, error_string(mk)])
return
var res: Resource = _silly_resource_from_values()
@@ -69,7 +69,7 @@ func _on_save_confirmed() -> void:
# Write SOURCE file (no ResourceSaver, works anywhere).
var ok := _write_source_silly(path, res)
if not ok:
- push_error("Material Creator: Failed to write source .mtxt at %s" % path)
+ push_error("Material Creator: Failed to write source .mtxt at \"%s\"." % path)
else:
print("Material Creator: Wrote source to ", path)
"silly_mat", "tres":
@@ -77,7 +77,7 @@ func _on_save_confirmed() -> void:
res.resource_path = path
var err := ResourceSaver.save(res, path)
if err != OK:
- push_error("Material Creator: Failed to save resource: %s (%s)" % [path, error_string(err)])
+ push_error("Material Creator: Failed to save resource: \"%s\" (%s)." % [path, error_string(err)])
else:
print("Material Creator: Saved resource to ", path)
_:
@@ -97,7 +97,7 @@ func apply_pressed() -> void:
# function (which only MeshInstance3D has by default). If they do, then set the material
# to the silly material.
for node in selected_nodes:
- if node.has_method("set_surface_override_material"):
+ if node.has_method(&"set_surface_override_material"):
node.set_surface_override_material(0, new_material)
@@ -108,7 +108,7 @@ func load_file_selected(path: String) -> bool:
# Load SOURCE by manual parse (works inside/outside res://)
var loaded := _read_source_silly(path)
if loaded == null:
- push_error("Material Creator: Failed to parse source at %s" % path)
+ push_error("Material Creator: Failed to parse source at \"%s\"." % path)
return false
$VBoxContainer/AlbedoColorPicker.color = loaded.albedo_color
$VBoxContainer/MetallicSlider.value = loaded.metallic_strength
@@ -118,7 +118,7 @@ func load_file_selected(path: String) -> bool:
# Load RESOURCE via ResourceLoader (silly_mat via your loader, tres via built-in)
var silly_resource: Resource = ResourceLoader.load(path)
if silly_resource == null:
- push_error("Material Creator: Failed to load resource at %s" % path)
+ push_error("Material Creator: Failed to load resource at \"%s\"." % path)
return false
$VBoxContainer/AlbedoColorPicker.color = silly_resource.albedo_color
$VBoxContainer/MetallicSlider.value = silly_resource.metallic_strength
diff --git a/plugins/addons/material_creator/material_resource.gd b/plugins/addons/material_creator/material_resource.gd
index 740d5dcc..1da13d4f 100644
--- a/plugins/addons/material_creator/material_resource.gd
+++ b/plugins/addons/material_creator/material_resource.gd
@@ -9,7 +9,7 @@ class_name SillyMaterialResource
# Create a StandardMaterial3D from the resource's properties.
-# Convert our data into an dictionary so we can convert it
+# Convert our data into a dictionary so we can convert it
# into the JSON format.
func make_json() -> String:
var json_dict := {}
diff --git a/viewport/2d_in_3d/pong.gd b/viewport/2d_in_3d/pong.gd
index 818ede02..f6043528 100644
--- a/viewport/2d_in_3d/pong.gd
+++ b/viewport/2d_in_3d/pong.gd
@@ -32,7 +32,7 @@ func _process(delta: float) -> void:
if (ball_pos.y < 0 and direction.y < 0) or (ball_pos.y > screen_size.y and direction.y > 0):
direction.y = -direction.y
- # Flip, change direction and increase speed when touching pads.
+ # Flip, change direction, and increase speed when touching pads.
if (left_rect.has_point(ball_pos) and direction.x < 0) or (right_rect.has_point(ball_pos) and direction.x > 0):
direction.x = -direction.x
ball_speed *= 1.1
diff --git a/viewport/3d_scaling/hud.gd b/viewport/3d_scaling/hud.gd
index 4cee9837..5a5b90d9 100644
--- a/viewport/3d_scaling/hud.gd
+++ b/viewport/3d_scaling/hud.gd
@@ -26,9 +26,9 @@ func _unhandled_input(event: InputEvent) -> void:
filter_mode = wrapi(filter_mode + 1, Viewport.SCALING_3D_MODE_BILINEAR, Viewport.SCALING_3D_MODE_MAX) as Viewport.Scaling3DMode
viewport.scaling_3d_mode = filter_mode
filter_label.text = (
- ClassDB.class_get_enum_constants("Viewport", "Scaling3DMode")[filter_mode]
+ ClassDB.class_get_enum_constants(&"Viewport", &"Scaling3DMode")[filter_mode]
.capitalize()
.replace("3d", "3D")
.replace("Mode", "Mode:")
.replace("Fsr", "FSR")
- )
+ )
diff --git a/viewport/dynamic_split_screen/README.md b/viewport/dynamic_split_screen/README.md
index 53dbfd44..fd53dfe8 100644
--- a/viewport/dynamic_split_screen/README.md
+++ b/viewport/dynamic_split_screen/README.md
@@ -15,7 +15,7 @@ A dynamic split screen system displays a single screen when
the two players are close but a split view when they move apart.
The splitting line can take any angle depending on the players'
-position, so it won't be either vertical or horizontal.
+positions, so it won't be either vertical or horizontal.
This system was popularized by the Lego video games.
diff --git a/viewport/dynamic_split_screen/camera_controller.gd b/viewport/dynamic_split_screen/camera_controller.gd
index cc85d693..ae330990 100644
--- a/viewport/dynamic_split_screen/camera_controller.gd
+++ b/viewport/dynamic_split_screen/camera_controller.gd
@@ -2,11 +2,11 @@ extends Node3D
# Handle the motion of both player cameras as well as communication with the
# SplitScreen shader to achieve the dynamic split screen effect
#
-# Cameras are place on the segment joining the two players, either in the middle
+# Cameras are placed on the segment joining the two players, either in the middle
# if players are close enough or at a fixed distance if they are not.
# In the first case, both cameras being at the same location, only the view of
# the first one is used for the entire screen thus allowing the players to play
-# on a unsplit screen.
+# on an unsplit screen.
# In the second case, the screen is split in two with a line perpendicular to the
# segment joining the two players.
#
@@ -38,8 +38,8 @@ func _ready() -> void:
get_viewport().size_changed.connect(_on_size_changed)
- view.material.set_shader_parameter("viewport1", viewport1.get_texture())
- view.material.set_shader_parameter("viewport2", viewport2.get_texture())
+ view.material.set_shader_parameter(&"viewport1", viewport1.get_texture())
+ view.material.set_shader_parameter(&"viewport2", viewport2.get_texture())
func _process(_delta: float) -> void:
@@ -75,11 +75,11 @@ func _update_splitscreen() -> void:
else:
thickness = split_line_thickness
- view.material.set_shader_parameter("split_active", _is_split_state())
- view.material.set_shader_parameter("player1_position", player1_position)
- view.material.set_shader_parameter("player2_position", player2_position)
- view.material.set_shader_parameter("split_line_thickness", thickness)
- view.material.set_shader_parameter("split_line_color", split_line_color)
+ view.material.set_shader_parameter(&"split_active", _is_split_state())
+ view.material.set_shader_parameter(&"player1_position", player1_position)
+ view.material.set_shader_parameter(&"player2_position", player2_position)
+ view.material.set_shader_parameter(&"split_line_thickness", thickness)
+ view.material.set_shader_parameter(&"split_line_color", split_line_color)
## Returns `true` if split screen is active (which occurs when players are
@@ -97,7 +97,7 @@ func _on_size_changed() -> void:
$Viewport1.size = screen_size
$Viewport2.size = screen_size
- view.material.set_shader_parameter("viewport_size", screen_size)
+ view.material.set_shader_parameter(&"viewport_size", screen_size)
func _get_position_difference_in_world() -> Vector3:
diff --git a/viewport/dynamic_split_screen/player.gd b/viewport/dynamic_split_screen/player.gd
index 03cfc0a5..24ab95db 100644
--- a/viewport/dynamic_split_screen/player.gd
+++ b/viewport/dynamic_split_screen/player.gd
@@ -8,11 +8,11 @@ extends CharacterBody3D
func _physics_process(_delta: float) -> void:
var move_direction := Input.get_vector(
- &"move_left_player" + str(player_id),
- &"move_right_player" + str(player_id),
- &"move_up_player" + str(player_id),
- &"move_down_player" + str(player_id),
- )
+ "move_left_player" + str(player_id),
+ "move_right_player" + str(player_id),
+ "move_up_player" + str(player_id),
+ "move_down_player" + str(player_id),
+ )
velocity.x += move_direction.x * walk_speed
velocity.z += move_direction.y * walk_speed
diff --git a/viewport/dynamic_split_screen/wall_coloring.gd b/viewport/dynamic_split_screen/wall_coloring.gd
index dcec3585..a20eeda9 100644
--- a/viewport/dynamic_split_screen/wall_coloring.gd
+++ b/viewport/dynamic_split_screen/wall_coloring.gd
@@ -5,7 +5,7 @@ extends Node3D
func _ready() -> void:
- var walls := get_tree().get_nodes_in_group("walls")
+ var walls := get_tree().get_nodes_in_group(&"walls")
for wall in walls:
var material := StandardMaterial3D.new()
material.albedo_color = Color(randf(), randf(), randf())
diff --git a/viewport/split_screen_input/player.gd b/viewport/split_screen_input/player.gd
index 985be5d0..0ae2a2b5 100644
--- a/viewport/split_screen_input/player.gd
+++ b/viewport/split_screen_input/player.gd
@@ -9,16 +9,16 @@ var _movement: Vector2 = Vector2(0, 0) # Current movement rate of node.
# Update movement variable based on input that reaches this SubViewport.
func _unhandled_input(event: InputEvent) -> void:
- if event.is_action_pressed("ux_up") or event.is_action_released("ux_down"):
+ if event.is_action_pressed(&"ux_up") or event.is_action_released(&"ux_down"):
_movement.y -= 1
get_viewport().set_input_as_handled()
- elif event.is_action_pressed("ux_down") or event.is_action_released("ux_up"):
+ elif event.is_action_pressed(&"ux_down") or event.is_action_released(&"ux_up"):
_movement.y += 1
get_viewport().set_input_as_handled()
- elif event.is_action_pressed("ux_left") or event.is_action_released("ux_right"):
+ elif event.is_action_pressed(&"ux_left") or event.is_action_released(&"ux_right"):
_movement.x -= 1
get_viewport().set_input_as_handled()
- elif event.is_action_pressed("ux_right") or event.is_action_released("ux_left"):
+ elif event.is_action_pressed(&"ux_right") or event.is_action_released(&"ux_left"):
_movement.x += 1
get_viewport().set_input_as_handled()
diff --git a/viewport/split_screen_input/root.gd b/viewport/split_screen_input/root.gd
index cb2bffe9..9d460f6a 100644
--- a/viewport/split_screen_input/root.gd
+++ b/viewport/split_screen_input/root.gd
@@ -28,7 +28,7 @@ var config: Dictionary = {
"color": Color(),
} # Split Screen configuration Dictionary.
-@onready var play_area: SubViewport = $PlayArea # The central Viewport, all Split Screens are sharing.
+@onready var play_area: SubViewport = $PlayArea # The central Viewport all Split Screens are sharing.
# Initialize each Split Screen and each player node.
diff --git a/xr/mobile_vr_interface_demo/main.gd b/xr/mobile_vr_interface_demo/main.gd
index efda161b..042623d6 100644
--- a/xr/mobile_vr_interface_demo/main.gd
+++ b/xr/mobile_vr_interface_demo/main.gd
@@ -7,10 +7,10 @@ func _ready():
xr_interface = XRServer.find_interface("Native mobile")
if xr_interface and xr_interface.initialize():
# Disable lens distortion.
- # xr_interface.k1 = 0.0
- # xr_interface.k2 = 0.0
+ #xr_interface.k1 = 0.0
+ #xr_interface.k2 = 0.0
- # setup viewport
+ # Set up viewport.
var vp = get_viewport()
vp.use_xr = true
vp.vrs_mode = Viewport.VRS_XR
@@ -21,13 +21,13 @@ func _ready():
func _process(delta):
var dir : Vector2 = Vector2()
- if Input.is_action_pressed("ui_left"):
+ if Input.is_action_pressed(&"ui_left"):
dir.x = -1.0
- elif Input.is_action_pressed("ui_right"):
+ elif Input.is_action_pressed(&"ui_right"):
dir.x = 1.0
- if Input.is_action_pressed("ui_up"):
+ if Input.is_action_pressed(&"ui_up"):
dir.y = -1.0
- elif Input.is_action_pressed("ui_down"):
+ elif Input.is_action_pressed(&"ui_down"):
dir.y = 1.0
$XROrigin3D.global_position += $XROrigin3D.global_transform.basis.x * dir.x * delta
diff --git a/xr/openxr_character_centric_movement/README.md b/xr/openxr_character_centric_movement/README.md
index 47702f71..a873c62b 100644
--- a/xr/openxr_character_centric_movement/README.md
+++ b/xr/openxr_character_centric_movement/README.md
@@ -21,8 +21,8 @@ The misunderstandings this causes in handling player movement is described in de
This demo implements the character body centric solution to the player movement problem.
Virtual movement by the player (e.g. movement through controller input) in this demo is handled similarly to a non-XR Godot game.
-Physical movement by the player will result in the character body attempting to move to the players new location.
-If successful the XROrigin node is moved in the opposite direction of the players movement.
+Physical movement by the player will result in the character body attempting to move to the player's new location.
+If successful the XROrigin node is moved in the opposite direction of the player's movement.
If unsuccessful the character body stays behind, the further the player moves the more we black out the screen.
## Action map
diff --git a/xr/openxr_character_centric_movement/objects/black_out.gd b/xr/openxr_character_centric_movement/objects/black_out.gd
index 148016c5..404cbeaf 100644
--- a/xr/openxr_character_centric_movement/objects/black_out.gd
+++ b/xr/openxr_character_centric_movement/objects/black_out.gd
@@ -15,7 +15,7 @@ func _update_fade() -> void:
$MeshInstance3D.visible = false
else:
if material:
- material.set_shader_parameter("albedo", Color(0.0, 0.0, 0.0, fade))
+ material.set_shader_parameter(&"albedo", Color(0.0, 0.0, 0.0, fade))
$MeshInstance3D.visible = true
diff --git a/xr/openxr_character_centric_movement/player.gd b/xr/openxr_character_centric_movement/player.gd
index 95c0942b..403fa6a5 100644
--- a/xr/openxr_character_centric_movement/player.gd
+++ b/xr/openxr_character_centric_movement/player.gd
@@ -32,12 +32,12 @@ func recenter() -> void:
XRServer.center_on_hmd(XRServer.RESET_BUT_KEEP_TILT, true)
# XRCamera3D node won't be updated yet, so go straight to the source!
- var head_tracker: XRPositionalTracker = XRServer.get_tracker("head")
+ var head_tracker: XRPositionalTracker = XRServer.get_tracker(&"head")
if not head_tracker:
push_error("Couldn't locate head tracker!")
return
- var pose: XRPose = head_tracker.get_pose("default")
+ var pose: XRPose = head_tracker.get_pose(&"default")
var head_transform: Transform3D = pose.get_adjusted_transform()
# Get neck transform in XROrigin3D space
@@ -53,17 +53,19 @@ func recenter() -> void:
# Finally reset character orientation
transform.basis = Basis()
+
# Returns our move input by querying the move action on each controller.
func _get_movement_input() -> Vector2:
var movement := Vector2()
# If move is not bound to one of our controllers,
# that controller will return `Vector2.ZERO`.
- movement += $XROrigin3D/LeftHand.get_vector2("move")
- movement += $XROrigin3D/RightHand.get_vector2("move")
+ movement += $XROrigin3D/LeftHand.get_vector2(&"move")
+ movement += $XROrigin3D/RightHand.get_vector2(&"move")
return movement
+
# `_process_on_physical_movement()` handles the physical movement of the player
# adjusting our character body position to "catch up to" the player.
# If the character body encounters an obstruction our view will black out
@@ -113,6 +115,7 @@ func _process_on_physical_movement(delta: float) -> bool:
black_out.fade = 0.0
return false
+
# `_process_movement_on_input()` handles movement through controller input.
# We first handle rotating the player and then apply movement.
# We also apply the effects of gravity at this point.
@@ -144,6 +147,7 @@ func _process_movement_on_input(is_colliding: bool, delta: float) -> void:
move_and_slide()
+
# `_physics_process()` handles our player movement.
func _physics_process(delta: float) -> void:
var is_colliding := _process_on_physical_movement(delta)
diff --git a/xr/openxr_composition_layers/README.md b/xr/openxr_composition_layers/README.md
index 687a4e8d..83947826 100644
--- a/xr/openxr_composition_layers/README.md
+++ b/xr/openxr_composition_layers/README.md
@@ -19,7 +19,7 @@ The subsequent quality loss often renders text unreadable or at the least ugly l
It turns out however that when 2D interfaces are presented on a virtual screen in front of the user,
often as a rectangle or slightly curved screen,
-that rendering this content ontop of the lens distorted 3D rendering,
+that rendering this content on top of the lens distorted 3D rendering,
and simply curving this 2D plane,
results in a high quality render.
diff --git a/xr/openxr_composition_layers/main.gd b/xr/openxr_composition_layers/main.gd
index bbcd6928..cc07fc62 100644
--- a/xr/openxr_composition_layers/main.gd
+++ b/xr/openxr_composition_layers/main.gd
@@ -13,10 +13,10 @@ func _ready():
# Callback for our tween to set the energy level on our active pointer.
func _update_energy(new_value : float):
- var pointer = active_hand.get_node("Pointer")
+ var pointer = active_hand.get_node(^"Pointer")
var material : ShaderMaterial = pointer.material_override
if material:
- material.set_shader_parameter("energy", new_value)
+ material.set_shader_parameter(&"energy", new_value)
# Start our tween to show a pulse on our click.
diff --git a/xr/openxr_hand_tracking_demo/README.md b/xr/openxr_hand_tracking_demo/README.md
index 2a5bdc85..4eb5b5e6 100644
--- a/xr/openxr_hand_tracking_demo/README.md
+++ b/xr/openxr_hand_tracking_demo/README.md
@@ -1,6 +1,6 @@
# XR Hand Tracking Demo
-This is a demo showing OpenXRs hand tracking and controller tracking logic.
+This is a demo showing OpenXR's hand tracking and controller tracking logic.
Language: GDScript
@@ -16,9 +16,9 @@ Renderer: Compatibility
## How does it work?
-Being able to see the players hands, and having those hands interact with elements in the environment are paramount to a good XR experience.
+Being able to see the player's hands, and having those hands interact with elements in the environment are paramount to a good XR experience.
-In this demo we look at the off the shelf logic for displaying a hand model that is automated based on either controller input or through optical tracking of the players hands.
+In this demo we look at the off the shelf logic for displaying a hand model that is automated based on either controller input or through optical tracking of the player's hands.
We also implement logic that allows interaction based on input from the action map that allows the user to pick up the blocks in this demo.
The problem this poses to us is that there have been two schools of thought around what hand tracking actually means,
@@ -45,7 +45,7 @@ and treats them as two versions of the same.
Especially with controllers like the Valve Index, or with various data gloves that are treated as controllers,
there is no discernible difference here.
-The hand tracking API is mostly used for visualising the players hand with bone positions either being inferred
+The hand tracking API is mostly used for visualising the player's hand with bone positions either being inferred
from controller input or matching the optical tracking.
For advanced gesture recognition you would still use this data however it is now accessible regardless of
the physical means in which this data is obtained.
@@ -56,10 +56,10 @@ gestures such as pinching and pointing resulting in inputs that can be bound in
OpenXR is moving towards this approach and this demo has been build in accordance with this however not all runtimes have been updated yet.
-SteamVR has followed this approach for a long time and works out of the box, however SteamVR treats everything as controllers resulting in some short comings when a Quest is used over Meta Link or Steam Link and optical hand tracking is used.
+SteamVR has followed this approach for a long time and works out of the box, however SteamVR treats everything as controllers resulting in some shortcomings when a Quest is used over Meta Link or Steam Link and optical hand tracking is used.
-Metas native Quest runtime on all versions of Quest now support OpenXRs "data source extension" which Godot enables when hand tracking is enabled.
-However Meta does not yet support OpenXRs "hand interaction profile extension" which is required.
+Metas native Quest runtime on all versions of Quest now support OpenXR's "data source extension" which Godot enables when hand tracking is enabled.
+However Meta does not yet support OpenXR's "hand interaction profile extension" which is required.
Meta link is still trailing behind and does not support this brave new world **yet**.
@@ -78,12 +78,12 @@ This demo project shows what that future looks like.
## Hand tracking API
-As mentioned, the hand tracking API is at the center of visualising the users hand.
+As mentioned, the hand tracking API is at the center of visualising the user's hand.
In Godot 4.3 we overhauled the system so the XR Interface needs to convert hand tracking data to the Godot humanoid skeleton hand bone layout.
This also means that this logic works both in WebXR, OpenXR and any other XR Interface that adds support for this feature.
Hand tracking now also makes use of the new Skeleton Modifier logic in Godot 4.3 however
-the skeleton is posed in the hands local space, while positioning is provided through a XRNode3D node.
+the skeleton is posed in the hands local space, while positioning is provided through an XRNode3D node.
This split is applied because:
@@ -125,7 +125,7 @@ differs between XR runtimes and can cause misalignment of the hand mesh.
## Action map
As mentioned, we're using the action map here for input however when optical hand tracking is used
-we rely on OpenXRs hand interaction profile extension.
+we rely on OpenXR's hand interaction profile extension.
Without support for this extension this demo will not fully function.
This can be solved by checking that no interaction profile has been bound to our XRController3D node,
diff --git a/xr/openxr_hand_tracking_demo/hand_info.gd b/xr/openxr_hand_tracking_demo/hand_info.gd
index 3dcf9d63..01470b3e 100644
--- a/xr/openxr_hand_tracking_demo/hand_info.gd
+++ b/xr/openxr_hand_tracking_demo/hand_info.gd
@@ -13,16 +13,16 @@ func _process(delta):
else:
text += "Right hand\n"
- var controller_tracker : XRPositionalTracker = XRServer.get_tracker("left_hand" if hand == 0 else "right_hand")
+ var controller_tracker : XRPositionalTracker = XRServer.get_tracker(&"left_hand" if hand == 0 else &"right_hand")
if controller_tracker:
var profile = controller_tracker.profile.replace("/interaction_profiles/", "").replace("/", " ")
text += "\nProfile: " + profile + "\n"
- var pose : XRPose = controller_tracker.get_pose("palm_pose")
+ var pose : XRPose = controller_tracker.get_pose(&"palm_pose")
if pose and pose.tracking_confidence != XRPose.XR_TRACKING_CONFIDENCE_NONE:
text +=" - Using palm pose\n"
else:
- pose = controller_tracker.get_pose("grip")
+ pose = controller_tracker.get_pose(&"grip")
if pose:
text +=" - Using grip pose\n"
@@ -40,7 +40,7 @@ func _process(delta):
else:
text += "\nNo controller tracker found!\n"
- var hand_tracker : XRHandTracker = XRServer.get_tracker("/user/hand_tracker/left" if hand == 0 else "/user/hand_tracker/right")
+ var hand_tracker : XRHandTracker = XRServer.get_tracker(&"/user/hand_tracker/left" if hand == 0 else &"/user/hand_tracker/right")
if hand_tracker:
text += "\nHand tracker found\n"
diff --git a/xr/openxr_hand_tracking_demo/pickup/pickup_able_body.gd b/xr/openxr_hand_tracking_demo/pickup/pickup_able_body.gd
index 351d57f2..9513dc5e 100644
--- a/xr/openxr_hand_tracking_demo/pickup/pickup_able_body.gd
+++ b/xr/openxr_hand_tracking_demo/pickup/pickup_able_body.gd
@@ -68,7 +68,7 @@ func pick_up(pick_up_by) -> void:
# Add code here to determine snap position and orientation.
# Now tween
- tween.tween_property(self, "transform", snap_to, 0.1)
+ tween.tween_property(self, ^"transform", snap_to, 0.1)
# Let this object go.
diff --git a/xr/openxr_hand_tracking_demo/pickup/pickup_handler.gd b/xr/openxr_hand_tracking_demo/pickup/pickup_handler.gd
index 226cda7d..5d2d0b07 100644
--- a/xr/openxr_hand_tracking_demo/pickup/pickup_handler.gd
+++ b/xr/openxr_hand_tracking_demo/pickup/pickup_handler.gd
@@ -2,7 +2,7 @@
class_name PickupHandler3D
extends Area3D
-# This area3D class detects all physics bodys based on
+# This area3D class detects all physics bodies based on
# PickupAbleBody3D within range and handles the logic
# for selecting the closest one and allowing pickup
# of that object.
diff --git a/xr/openxr_hand_tracking_demo/xr_hand_fallback_modifier_3d.gd b/xr/openxr_hand_tracking_demo/xr_hand_fallback_modifier_3d.gd
index 01c8894a..5bbbac30 100644
--- a/xr/openxr_hand_tracking_demo/xr_hand_fallback_modifier_3d.gd
+++ b/xr/openxr_hand_tracking_demo/xr_hand_fallback_modifier_3d.gd
@@ -69,11 +69,11 @@ func _process_modification() -> void:
var r : Transform3D
t = t * r.rotated(Vector3(1.0, 0.0, 0.0), deg_to_rad(20.0) * trigger)
elif bone_name == "LeftMiddleDistal" or bone_name == "LeftMiddleIntermediate" or bone_name == "LeftMiddleProximal" \
- or bone_name == "RightMiddleDistal" or bone_name == "RightMiddleIntermediate" or bone_name == "RightMiddleProximal" \
- or bone_name == "LeftRingDistal" or bone_name == "LeftRingIntermediate" or bone_name == "LeftRingProximal" \
- or bone_name == "RightRingDistal" or bone_name == "RightRingIntermediate" or bone_name == "RightRingProximal" \
- or bone_name == "LeftLittleDistal" or bone_name == "LeftLittleIntermediate" or bone_name == "LeftLittleProximal" \
- or bone_name == "RightLittleDistal" or bone_name == "RightLittleIntermediate" or bone_name == "RightLittleProximal":
+ or bone_name == "RightMiddleDistal" or bone_name == "RightMiddleIntermediate" or bone_name == "RightMiddleProximal" \
+ or bone_name == "LeftRingDistal" or bone_name == "LeftRingIntermediate" or bone_name == "LeftRingProximal" \
+ or bone_name == "RightRingDistal" or bone_name == "RightRingIntermediate" or bone_name == "RightRingProximal" \
+ or bone_name == "LeftLittleDistal" or bone_name == "LeftLittleIntermediate" or bone_name == "LeftLittleProximal" \
+ or bone_name == "RightLittleDistal" or bone_name == "RightLittleIntermediate" or bone_name == "RightLittleProximal":
var r : Transform3D
t = t * r.rotated(Vector3(1.0, 0.0, 0.0), deg_to_rad(90.0) * grip)
diff --git a/xr/openxr_origin_centric_movement/README.md b/xr/openxr_origin_centric_movement/README.md
index fad08d59..d4af435f 100644
--- a/xr/openxr_origin_centric_movement/README.md
+++ b/xr/openxr_origin_centric_movement/README.md
@@ -1,6 +1,6 @@
# XR Origin Centric Movement demo
-This is a demo for an OpenXR project where player movement is handled with a XRorigin3D as a base node.
+This is a demo for an OpenXR project where player movement is handled with an XRorigin3D as a base node.
This is based on the [Origin centric solution as explained in the room scale manual page](https://docs.godotengine.org/en/stable/tutorials/xr/xr_room_scale.html#origin-centric-solution).
Language: GDScript
diff --git a/xr/openxr_origin_centric_movement/objects/black_out.gd b/xr/openxr_origin_centric_movement/objects/black_out.gd
index d095e4c9..5c4c2db9 100644
--- a/xr/openxr_origin_centric_movement/objects/black_out.gd
+++ b/xr/openxr_origin_centric_movement/objects/black_out.gd
@@ -14,7 +14,7 @@ func _update_fade() -> void:
$MeshInstance3D.visible = false
else:
if material:
- material.set_shader_parameter("albedo", Color(0.0, 0.0, 0.0, fade))
+ material.set_shader_parameter(&"albedo", Color(0.0, 0.0, 0.0, fade))
$MeshInstance3D.visible = true
diff --git a/xr/openxr_origin_centric_movement/player.gd b/xr/openxr_origin_centric_movement/player.gd
index 9a50fac2..5af4d339 100644
--- a/xr/openxr_origin_centric_movement/player.gd
+++ b/xr/openxr_origin_centric_movement/player.gd
@@ -42,17 +42,19 @@ func recenter() -> void:
# Recenter character body.
character_body.transform = Transform3D()
+
# `_get_movement_input()` returns our move input by querying the move action on each controller.
func _get_movement_input() -> Vector2:
var movement : Vector2 = Vector2()
# If move is not bound to one of our controllers,
# that controller will return `Vector2.ZERO`.
- movement += $LeftHand.get_vector2("move")
- movement += $RightHand.get_vector2("move")
+ movement += $LeftHand.get_vector2(&"move")
+ movement += $RightHand.get_vector2(&"move")
return movement
+
# `_process_on_physical_movement` handles the physical movement of the player
# adjusting our character body position to "catch up to" the player.
# If the character body encounters an obstruction our view will black out