Replace use of rotation_degrees in Running code in the editor (#6026)

This commit is contained in:
Gilles
2022-08-04 10:22:27 +02:00
committed by GitHub
parent 1497aa0ec0
commit e95f58e58d

View File

@@ -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;
}
}