From e95f58e58d2b3e39de15aafc5ce71162ebaa2b4e Mon Sep 17 00:00:00 2001 From: Gilles Date: Thu, 4 Aug 2022 10:22:27 +0200 Subject: [PATCH] Replace use of `rotation_degrees` in Running code in the editor (#6026) --- .../plugins/running_code_in_the_editor.rst | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tutorials/plugins/running_code_in_the_editor.rst b/tutorials/plugins/running_code_in_the_editor.rst index 502d90d3d..da9c7089f 100644 --- a/tutorials/plugins/running_code_in_the_editor.rst +++ b/tutorials/plugins/running_code_in_the_editor.rst @@ -124,7 +124,7 @@ and open a script, and change it to this: extends Sprite2D func _process(delta): - rotation_degrees += 180 * delta + rotation += PI * delta .. code-tab:: csharp @@ -136,7 +136,7 @@ and open a script, and change it to this: { public override void _Process(float delta) { - RotationDegrees += 180 * delta; + Rotation += Mathf.Pi * delta; } } @@ -157,9 +157,9 @@ look like this: func _process(delta): if Engine.is_editor_hint(): - rotation_degrees += 180 * delta + rotation += PI * delta else: - rotation_degrees -= 180 * delta + rotation -= PI * delta .. code-tab:: csharp @@ -167,11 +167,11 @@ look like this: { if (Engine.IsEditorHint()) { - RotationDegrees += 180 * delta; + Rotation += Mathf.Pi * delta; } else { - RotationDegrees -= 180 * delta; + Rotation -= Mathf.Pi * delta; } } @@ -196,11 +196,11 @@ Add and export a variable speed to the script. The function set_speed after # Update speed and reset the rotation. set(new_speed): speed = new_speed - rotation_degrees = 0 + rotation = 0 func _process(delta): - rotation_degrees += 180 * delta * speed + rotation += PI * delta * speed .. code-tab:: csharp @@ -222,12 +222,12 @@ Add and export a variable speed to the script. The function set_speed after private void SetSpeed(float newSpeed) { speed = newSpeed; - RotationDegrees = 0; + Rotation = 0; } public override void _Process(float delta) { - RotationDegrees += 180 * delta * speed; + Rotation += Mathf.Pi * delta * speed; } }