瀏覽代碼

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

Gilles 3 年之前
父節點
當前提交
e95f58e58d
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      tutorials/plugins/running_code_in_the_editor.rst

+ 10 - 10
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;
         }
     }