Merge branch 'master' into 3.2

This commit is contained in:
Rémi Verschelde
2020-09-09 12:58:12 +02:00
55 changed files with 699 additions and 298 deletions

View File

@@ -284,7 +284,7 @@ Literals
+--------------------------+----------------------------------------+
| ``45`` | Base 10 integer |
+--------------------------+----------------------------------------+
| ``0x8F51`` | Base 16 (hexadecimal) integer |
| ``0x8f51`` | Base 16 (hexadecimal) integer |
+--------------------------+----------------------------------------+
| ``0b101010`` | Base 2 (binary) integer |
+--------------------------+----------------------------------------+
@@ -299,6 +299,14 @@ Literals
| ``$NodePath`` | Shorthand for ``get_node("NodePath")`` |
+--------------------------+----------------------------------------+
Integers and floats can have their numbers separated with ``_`` to make them more readable.
The following ways to write numbers are all valid::
12_345_678 # Equal to 12345678.
3.141_592_7 # Equal to 3.1415927.
0x8080_0000_ffff # Equal to 0x80800000ffff.
0b11_00_11_00 # Equal to 0b11001100.
Comments
~~~~~~~~

View File

@@ -418,6 +418,53 @@ characters in a given string. See the examples below:
# Both quote styles would require 2 escapes; prefer double quotes if it's a tie.
print("'hello' \"world\"")
Numbers
~~~~~~~
Don't omit the leading or trailing zero in floating-point numbers. Otherwise,
this makes them less readable and harder to distinguish from integers at a
glance.
**Good**::
var float_number = 0.234
var other_float_number = 13.0
**Bad**::
var float_number = .234
var other_float_number = 13.
Use lowercase for letters in hexadecimal numbers, as their lower height makes
the number easier to read.
**Good**::
var hex_number = 0xfb8c0b
**Bad**::
var hex_number = 0xFB8C0B
Take advantage of GDScript's underscores in literals to make large numbers more
readable.
**Good**::
var large_number = 1_234_567_890
var large_hex_number = 0xffff_f8f8_0000
var large_bin_number = 0b1101_0010_1010
# Numbers lower than 1000000 generally don't need separators.
var small_number = 12345
**Bad**::
var large_number = 1234567890
var large_hex_number = 0xfffff8f80000
var large_bin_number = 0b110100101010
# Numbers lower than 1000000 generally don't need separators.
var small_number = 12_345
.. _naming_conventions:
Naming conventions

View File

@@ -267,7 +267,7 @@ These are nodes you can use as temporary storage for your graphs. Make sure they
.. image:: img/visual_script41.png
As it can be seen above, there are two nodes available: A simple getter, and a sequenced getter (setting requires a sequence port).
As it can be seen above, there are two nodes available: A simple getter, and a sequenced setter (setting requires a sequence port).
Scene Node