ソースを参照

Clarifications and grammar fixes + new section

Added section in "Your first game" on cleaning up old creeps.
No C# example code or references implemented yet.
bitbutter 6 年 前
コミット
d2d5104490

+ 16 - 11
getting_started/step_by_step/scripting_continued.rst

@@ -17,8 +17,7 @@ Idle processing is activated when the method :ref:`Node._process() <class_Node_m
 is found in a script. It can be turned off and on with the
 :ref:`Node.set_process() <class_Node_method_set_process>` function.
 
-This method will be called every time a frame is drawn, so it's fully dependent on
-how many frames per second (FPS) the application is running at:
+This method will be called every time a frame is drawn:
 
 .. tabs::
  .. code-tab:: gdscript GDScript
@@ -34,8 +33,12 @@ how many frames per second (FPS) the application is running at:
         // Do something...
     }
 
-The delta parameter contains the time elapsed in seconds, as a
-floating point, since the previous call to ``_process()``.
+It's important to bear in mind that the frequecy with which ``_process()``
+will be called depends on how many frames per second (FPS) your application
+is running at. This rate can vary over time and devices.
+
+To help manage this variability the ``delta`` parameter contains the time
+elapsed in seconds, as a floating point, since the previous call to ``_process()``.
 
 This parameter can be used to make sure things always take the same
 amount of time, regardless of the game's FPS.
@@ -52,7 +55,7 @@ Physics -> Common -> Physics Fps.
 The function ``_process()``, however, is not synced with physics. Its frame rate is not constant and is dependent
 on hardware and game optimization. Its execution is done after the physics step on single-threaded games.
 
-A simple way to test this is to create a scene with a single Label node,
+A simple way to see the ``_process()`` function at work is to create a scene with a single Label node,
 with the following script:
 
 .. tabs::
@@ -84,13 +87,15 @@ Which will show a counter increasing each frame.
 Groups
 ------
 
-Nodes can be added to groups, as many as desired per node, and is a useful feature for organizing large scenes.
-There are two ways to do this. The first is from the UI, from the Groups button under the Node panel:
+Groups in Godot work like tags you might have come across in other software.
+A node can be added to as many groups as desired. This is a useful feature for
+organizing large scenes. There are two ways to do add nodes to groups. The
+first is from the UI, using the Groups button under the Node panel:
 
 .. image:: img/groups_in_nodes.png
 
-And the second way is from code. One example would be to tag nodes
-which are enemies:
+And the second way is from code. The following script would add the current
+node to the ``enemies`` group as soon as it appeared in the scene tree.
 
 .. tabs::
  .. code-tab:: gdscript GDScript
@@ -145,7 +150,7 @@ like interacting with scenes, their node hierarchy and groups of nodes.
 It allows you to easily switch scenes or reload them,
 to quit the game or pause and unpause it.
 It even comes with interesting signals.
-So check it out if you got some time!
+So check it out if you have some time!
 
 Notifications
 -------------
@@ -310,7 +315,7 @@ used:
         _sprite.Free(); // Immediately removes the node from the scene and frees it.
     }
 
-When a node is freed, it also frees all its children nodes. Because of
+When a node is freed, it also frees all its child nodes. Because of
 this, manually deleting nodes is much simpler than it appears. Free
 the base node and everything else in the subtree goes away with it.
 

+ 20 - 18
getting_started/step_by_step/ui_introduction_to_the_ui_system.rst

@@ -7,10 +7,7 @@ Computer displays, mobile phones, and TV screen come in all shapes and
 sizes. To ship a game, you'll need to support different screen ratios
 and resolutions. It can be hard to build responsive interfaces that
 adapt to all platforms. Thankfully, Godot comes with robust tools to
-design and manage a responsive User Interface. To design your UI, you'll
-use the Control nodes. These are the nodes with green icons in the
-editor. There are dozens of them, to create anything from life bars to
-complex applications. Godot's entire editor and plugins use these nodes.
+design and manage a responsive User Interface.
 
 .. figure:: img/godot_editor_ui.png
 
@@ -18,7 +15,7 @@ complex applications. Godot's entire editor and plugins use these nodes.
 
 This guide will get you started with UI design. You will learn:
 
--  The five most useful control nodes to build your games interface
+-  The five most useful control nodes to build your games' interface
 -  How to work with the anchor of UI elements
 -  How to efficiently place and arrange your user interface using
    containers
@@ -28,12 +25,13 @@ This guide will get you started with UI design. You will learn:
 To learn how to control the interface and connect it to other scripts,
 read :ref:`Build your first game UI in Godot <doc_ui_game_user_interface>`.
 
-Only use Control nodes when you design your interfaces. They have unique
-properties that allow them to work with one another. Other nodes, like
-Node2D, Sprite, etc. will not work. You can still use some nodes that
-work with others, like the AnimationPlayer, Tween or the StreamPlayer.
-Control nodes are CanvasItems like Node2D, so you can apply shaders to
-them.
+To design your UI, you'll use the Control nodes. These are the nodes with green icons in the
+editor. There are dozens of them, for creating anything from life bars to
+complex applications. Godot's editor itself is built using Control nodes.
+
+Control nodes have unique properties that allow them to work well with one another.
+Other visual nodes, like Node2D and Sprite don't have these capabilities. So to
+make your life easier use Control nodes wherever possible when building your UIs.
 
 All control nodes share the same main properties:
 
@@ -76,14 +74,18 @@ TextureRect
 It seems similar to the Sprite node, but it offers multiple scaling modes.
 Set the Stretch Mode property to change its behavior:
 
-- ``Scale On Expand (compat)`` scales the texture to fit the node’s bounding rectangle, only if ``expand`` property is ``true``; otherwise, it behaves like ``Keep`` mode. Default mode for backwards compatibility.
-- ``Scale`` scales the texture to fit the node’s bounding rectangle
-- ``Tile`` makes the texture repeat, but it won't scale
+- ``Scale On Expand (compat)`` scales the texture to fit the node's bounding rectangle,
+  only if ``expand`` property is ``true``; otherwise, it behaves like ``Keep`` mode.
+  Default mode for backwards compatibility.
+- ``Scale`` scales the texture to fit the node's bounding rectangle.
+- ``Tile`` makes the texture repeat, but it won't scale.
 -  ``Keep`` and ``Keep Centered`` force the texture to remain at its
    original size, in the top left corner or the center of the frame
-   respectively
-- ``Keep Aspect`` and ``Keep Aspect Centered`` scales the texture but force it to remain its original aspect ratio, in the top left corner or the center of the frame respectively
-- ``Keep Aspect Covered`` works just like ``Keep Aspect Centered`` but the shorter side fits the bounding rectangle and the other one clips to the node’s limits
+   respectively.
+- ``Keep Aspect`` and ``Keep Aspect Centered`` scales the texture but force it to remain
+  its original aspect ratio, in the top left corner or the center of the frame respectively.
+- ``Keep Aspect Covered`` works just like ``Keep Aspect Centered`` but the shorter side
+  fits the bounding rectangle and the other one clips to the node's limits.
 
 As with Sprite nodes, you can modulate the TextureRect's color. Click
 the ``Modulate`` property and use the color picker.
@@ -196,7 +198,7 @@ Like any properties, you can edit the 4 anchor points in the Inspector,
 but this is not the most convenient way. When you select a control node,
 the layout menu appears above the viewport, in the toolbar. It gives you
 a list of icons to set all 4 anchors with a single click, instead of
-using the inspectors 4 properties. The layout menu will only show up
+using the inspector's 4 properties. The layout menu will only show up
 when you select a control node.
 
 .. figure:: img/layout_menu.png

+ 33 - 0
getting_started/step_by_step/your_first_game.rst

@@ -1125,6 +1125,39 @@ sync with the changing score:
 Now you're ready to play! Click the "Play the Project" button. You will
 be asked to select a main scene, so choose ``Main.tscn``.
 
+Removing old creeps
+~~~~~~~~~~~~~~~~~~~
+
+If you play until "Game Over" and then start a new game the creeps from the
+previous game are still on screen. It would be better if they all disappeared
+at the start of a new game.
+
+We'll use the ``start_game`` signal that's already being emitted by the ``HUD``
+node to remove the remaining creeps. We can't use the editor to connect the
+signal to the mobs in the way we need because there are no ``Mob`` nodes in the
+``Main`` scene tree until we run the game. Instead we'll use code.
+
+Start by adding a new function to ``Mob.gd``. ``queue_free()`` will delete the
+current node at the end of the current frame.
+
+.. tabs::
+ .. code-tab:: gdscript GDScript
+
+    func _on_start_game():
+        queue_free()
+          
+Then in ``Main.gd`` add a new line inside the ``_on_MobTimer_timeout()`` function,
+at the end.
+
+.. tabs::
+ .. code-tab:: gdscript GDScript
+
+    $HUD.connect("start_game", mob, "_on_start_game")
+
+This line tells the new Mob node (referenced by the ``mob`` variable) to respond
+to any ``start_game`` signal emitted by the ``HUD`` node by running its
+``_on_start_game()`` function.
+
 Finishing up
 ------------