Pārlūkot izejas kodu

Merge branch 'master' into 3.2

Rémi Verschelde 4 gadi atpakaļ
vecāks
revīzija
6d8c7b1d1a

+ 1 - 1
community/contributing/updating_the_class_reference.rst

@@ -288,7 +288,7 @@ the end of the description:
     [b]Note:[/b] Only available when using the GLES2 renderer.
 
 To denote crucial information that could cause security issues or loss of data
-if not followed carefully, add a paragraph starting with "[b]Warning:[/b] at the
+if not followed carefully, add a paragraph starting with "[b]Warning:[/b]" at the
 end of the description:
 
 .. code-block:: none

+ 23 - 15
getting_started/scripting/gdscript/gdscript_styleguide.rst

@@ -735,36 +735,44 @@ Static typing
 
 Since Godot 3.1, GDScript supports :ref:`optional static typing<doc_gdscript_static_typing>`.
 
-Type hints
-~~~~~~~~~~
+Declared types
+~~~~~~~~~~~~~~
 
-Place the colon right after the variable's name, without a space, and let the
-GDScript compiler infer the variable's type when possible.
+To declare a variable's type, use ``<variable>: <type>``:
 
-**Good**:
+::
+
+   var health: int = 0
+
+To declare the return type of a function, use ``-> <type>``:
 
 ::
 
-   onready var health_bar: ProgressBar = get_node("UI/LifeBar")
+   func heal(amount: int) -> void:
 
-   var health := 0 # The compiler will use the int type.
+Inferred types
+~~~~~~~~~~~~~~
 
-**Bad**:
+In most cases you can let the compiler infer the type, using ``:=``:
 
 ::
+   var health := 0  # The compiler will use the int type.
 
-   # The compiler can't infer the exact type and will use Node
-   # instead of ProgressBar.
-   onready var health_bar := get_node("UI/LifeBar")
+However, in a few cases when context is missing, the compiler falls back to
+the function's return type. For example, ``get_node()`` cannot infer a type
+unless the scene or file of the node is loaded in memory. In this case, you
+should set the type explicitly.
 
-When you let the compiler infer the type hint, write the colon and equal signs together: ``:=``.
+**Good**:
 
 ::
 
-   var health := 0 # The compiler will use the int type.
+   onready var health_bar: ProgressBar = get_node("UI/LifeBar")
 
-Add a space on either sides of the return type arrow when defining functions.
+**Bad**:
 
 ::
 
-   func heal(amount: int) -> void:
+   # The compiler can't infer the exact type and will use Node
+   # instead of ProgressBar.
+   onready var health_bar := get_node("UI/LifeBar")

BIN
tutorials/2d/img/autotile_template_2x2.png


BIN
tutorials/2d/img/autotile_template_3x3_minimal.png


BIN
tutorials/2d/img/autotile_template_3x3_minimal_topdown_floor.png


BIN
tutorials/2d/img/autotile_template_3x3_minimal_topdown_walls.png


BIN
tutorials/2d/img/autotile_template_3x3_minimal_topdown_walls_tall.png


BIN
tutorials/2d/img/autotile_template_3x3_minimal_topdown_walls_thick.png


+ 62 - 7
tutorials/2d/using_tilemaps.rst

@@ -211,25 +211,80 @@ can test for.
 2x2 mode can only match cells that are part of a 2-by-2 block - cells with no
 neighbors and lines only one cell wide are not supported.
 
+**Template - Generic:**
+
+This template can be used for sideways or fully top-down perspectives.
+It's designed for a TileMap cell size of 64x64.
+
+Key:
+
+- Red: "on"
+- White: "off"
+
+.. image:: img/autotile_template_2x2.png
+
 3x3 (minimal)
 ~~~~~~~~~~~~~
 
 In 3x3 (minimal) mode, each bitmask contains 9 bits (4 corners, 4 edges,
-1 center).
-
-The 4 corner bits work the same as in 2x2 mode.
+1 center). The 4 corner bits work the same as in 2x2 mode.
 
 When an edge bit is "on", the cell which shares that edge must be filled.
 When an edge bit is "off", the cell which shares that edge must be empty.
 
-The center bit should be "on" for any tile you wish to use.
-
-Note that in this mode, it makes no sense for a corner bit to be "on" when
-either edge bit adjacent to it is not "on".
+The center bit should be "on" for any tile you wish to use. Note that in this
+mode, it makes no sense for a corner bit to be "on" when either edge bit
+adjacent to it is not "on".
 
 A total of 47 tiles would be needed to provide exactly one bitmask for each
 arrangement that this mode can test for.
 
+.. note::
+
+    Right-click an image and choose **Save image as…** to save it.
+
+**Template - Generic:**
+
+This template can be used for sideways or fully top-down perspectives.
+All templates below are designed for a TileMap cell size of 64x64, but you may
+have to use different subtile sizes for top-down templates as described below.
+
+Key:
+
+- Red: "on"
+- White: "off"
+
+.. image:: img/autotile_template_3x3_minimal.png
+
+
+**Template - Top-down floor in 3/4 perspective:**
+
+Key (applies to the four templates below):
+
+- Green: floor
+- Cyan: wall
+- Yellow: top of wall
+- Transparent: air
+
+.. image:: img/autotile_template_3x3_minimal_topdown_floor.png
+
+**Template - Top-down wall in 3/4 perspective:**
+
+.. image:: img/autotile_template_3x3_minimal_topdown_walls.png
+
+**Template - Top-down wall in 3/4 perspective (thick walls):**
+
+When using this template, set the TileSet subtile size to ``Vector2(64, 88)``.
+
+.. image:: img/autotile_template_3x3_minimal_topdown_walls_thick.png
+
+**Template - Top-down wall in 3/4 perspective (tall walls):**
+
+When using this template, set the "Snap Options" Step to ``Vector2(64, 184)``
+and the "Selected Tile" Texture offset to height minus the cell size.
+This means the texture offset should be ``Vector2(0, -120)``:
+
+.. image:: img/autotile_template_3x3_minimal_topdown_walls_tall.png
 
 3x3
 ~~~

+ 43 - 41
tutorials/gui/bbcode_in_richtextlabel.rst

@@ -41,51 +41,53 @@ markup. All changes to the text must be done in the BBCode parameter.
 
 .. note::
 
-    For BBCode tags such as ``[b]`` (bold) or ``[i]`` (italics) to work you must
-    set up custom fonts for the RichTextLabel node first.
+    For BBCode tags such as ``[b]`` (bold), ``[i]`` (italics) or ``[code]`` to
+    work, you must set up custom fonts for the RichTextLabel node first.
+
+    There are no BBCode tags to control vertical centering of text yet.
 
 Reference
 ---------
 
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| Command           | Tag                                        | Description                                                  |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **bold**          | ``[b]{text}[/b]``                          | Makes {text} bold.                                           |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **italics**       | ``[i]{text}[/i]``                          | Makes {text} italics.                                        |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **underline**     | ``[u]{text}[/u]``                          | Makes {text} underline.                                      |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **strikethrough** | ``[s]{text}[/s]``                          | Makes {text} strikethrough.                                  |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **code**          | ``[code]{text}[/code]``                    | Makes {text} monospace.                                      |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **center**        | ``[center]{text}[/center]``                | Makes {text} centered.                                       |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **right**         | ``[right]{text}[/right]``                  | Makes {text} right-aligned.                                  |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **fill**          | ``[fill]{text}[/fill]``                    | Makes {text} fill width.                                     |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **indent**        | ``[indent]{text}[/indent]``                | Increase indent level of {text}.                             |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **url**           | ``[url]{url}[/url]``                       | Show {url} as such.                                          |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **url (ref)**     | ``[url=<url>]{text}[/url]``                | Makes {text} reference <url>.                                |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **image**         | ``[img]{path}[/img]``                      | Insert image at resource {path}.                             |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **resized image** | ``[img=<width>]{path}[/img]``              | Insert image at resource {path} using <width> (keeps ratio). |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **resized image** | ``[img=<width>x<height>]{path}[/img]``     | Insert image at resource {path} using <width> & <height>.    |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **font**          | ``[font=<path>]{text}[/font]``             | Use custom font at <path> for {text}.                        |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **color**         | ``[color=<code/name>]{text}[/color]``      | Change {text} color; use name or # format, such as #ff00ff.  |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **table**         | ``[table=<number>]{cells}[/table]``        | Creates a table with <number> of columns.                    |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
-| **cell**          | ``[cell]{text}[/cell]``                    | Adds cells with the {text} to the table.                     |
-+-------------------+--------------------------------------------+--------------------------------------------------------------+
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| Command           | Tag                                        | Description                                                     |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **bold**          | ``[b]{text}[/b]``                          | Makes {text} bold.                                              |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **italics**       | ``[i]{text}[/i]``                          | Makes {text} italics.                                           |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **underline**     | ``[u]{text}[/u]``                          | Makes {text} underline.                                         |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **strikethrough** | ``[s]{text}[/s]``                          | Makes {text} strikethrough.                                     |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **code**          | ``[code]{text}[/code]``                    | Makes {text} use the code font (which is typically monospace).  |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **center**        | ``[center]{text}[/center]``                | Makes {text} horizontally centered.                             |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **right**         | ``[right]{text}[/right]``                  | Makes {text} horizontally right-aligned.                        |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **fill**          | ``[fill]{text}[/fill]``                    | Makes {text} fill the RichTextLabel's width.                    |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **indent**        | ``[indent]{text}[/indent]``                | Increase the indentation level of {text}.                       |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **url**           | ``[url]{url}[/url]``                       | Show {url} as such, underline it and make it clickable.         |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **url (ref)**     | ``[url=<url>]{text}[/url]``                | Makes {text} reference <url> (underlined and clickable).        |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **image**         | ``[img]{path}[/img]``                      | Insert image at resource {path}.                                |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **resized image** | ``[img=<width>]{path}[/img]``              | Insert image at resource {path} using <width> (keeps ratio).    |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **resized image** | ``[img=<width>x<height>]{path}[/img]``     | Insert image at resource {path} using <width>×<height>.         |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **font**          | ``[font=<path>]{text}[/font]``             | Use custom font at <path> for {text}.                           |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **color**         | ``[color=<code/name>]{text}[/color]``      | Change {text} color; use name or # format, such as ``#ff00ff``. |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **table**         | ``[table=<number>]{cells}[/table]``        | Creates a table with <number> of columns.                       |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
+| **cell**          | ``[cell]{text}[/cell]``                    | Adds cells with the {text} to the table.                        |
++-------------------+--------------------------------------------+-----------------------------------------------------------------+
 
 Built-in color names
 ~~~~~~~~~~~~~~~~~~~~

+ 1 - 1
tutorials/io/encrypting_save_games.rst

@@ -26,7 +26,7 @@ But what if someone were to find a way to edit the saved games and
 assign the items and currency without effort? That would be terrible,
 because it would help players consume the content much faster, and therefore
 run out of it sooner than expected. If that happens, they will have
-nothing that avoids them to think, and the tremendous agony of realizing
+nothing that prevents them from thinking, and the tremendous agony of realizing
 their own irrelevance would again take over their life.
 
 No, we definitely do not want that to happen, so let's see how to

+ 2 - 2
tutorials/math/matrices_and_transforms.rst

@@ -235,7 +235,7 @@ Putting it all together
 ~~~~~~~~~~~~~~~~~~~~~~~
 
 We're going to apply everything we mentioned so far onto one transform.
-To follow along, create a simple project with a Sprite node and use the 
+To follow along, create a simple project with a Sprite node and use the
 Godot logo for the texture resource.
 
 Let's set the translation to (350, 150), rotate by -0.5 rad, and scale by 3.
@@ -290,7 +290,7 @@ matrix has four total numbers in two :ref:`class_Vector2` values, while
 a rotation value and a Vector2 for scale only has 3 numbers. The high-level
 concept for the missing degree of freedom is called *shearing*.
 
-Normally you will always have the basis vectors perpendicular to each
+Normally, you will always have the basis vectors perpendicular to each
 other. However, shearing can be useful in some situations, and
 understanding shearing helps you understand how transforms work.
 

+ 1 - 1
tutorials/physics/using_kinematic_body_2d.rst

@@ -265,7 +265,7 @@ Attach a script to the KinematicBody2D and add the following code:
         public override void _PhysicsProcess(float delta)
         {
             GetInput();
-            MoveAndCollide(velocity * delta);
+            MoveAndCollide(_velocity * delta);
         }
     }