Misc formatting fixes

This commit is contained in:
Rémi Verschelde
2020-04-27 12:17:47 +02:00
parent c54b8d6639
commit e6b00ca97a
11 changed files with 81 additions and 81 deletions

View File

@@ -231,7 +231,7 @@ Since AudioStreamPlayback is controlled by the audio thread, i/o and dynamic mem
Resampling
~~~~~~~~~~
Godots AudioServer currently uses 44100 Hz sample rate. When other sample rates are
Godot's AudioServer currently uses 44100 Hz sample rate. When other sample rates are
needed such as 48000, either provide one or use AudioStreamPlaybackResampled.
Godot provides cubic interpolation for audio resampling.

View File

@@ -23,10 +23,10 @@ A brief look at static typing
-----------------------------
With typed GDScript, Godot can detect even more errors as you write
code! It gives you and your teammates more information as youre
working, as the arguments types show up when you call a method.
code! It gives you and your teammates more information as you're
working, as the arguments' types show up when you call a method.
Imagine youre programming an inventory system. You code an ``Item``
Imagine you're programming an inventory system. You code an ``Item``
node, then an ``Inventory``. To add items to the inventory, the people
who work with your code should always pass an ``Item`` to the
``Inventory.add`` method. With types, you can enforce this:
@@ -56,14 +56,14 @@ Static types also give you better code completion options. Below, you
can see the difference between a dynamic and a static typed completion
options for a class called ``PlayerController``.
Youve probably stored a node in a variable before, and typed a dot to
You've probably stored a node in a variable before, and typed a dot to
be left with no autocomplete suggestions:
.. figure:: ./img/typed_gdscript_code_completion_dynamic.png
:alt: code completion options for dynamic
This is due to dynamic code. Godot cannot know what node or value type
youre passing to the function. If you write the type explicitly
you're passing to the function. If you write the type explicitly
however, you will get all public methods and variables from the node:
.. figure:: ./img/typed_gdscript_code_completion_typed.png
@@ -75,9 +75,9 @@ on the roadmap!
Overall, typed programming gives you a more structured experience. It
helps prevent errors and improves the self-documenting aspect of your
scripts. This is especially helpful when youre working in a team or on
scripts. This is especially helpful when you're working in a team or on
a long-term project: studies have shown that developers spend most of
their time reading other peoples code, or scripts they wrote in the
their time reading other people's code, or scripts they wrote in the
past and forgot about. The clearer and the more structured the code, the
faster it is to understand, the faster you can move forward.
@@ -85,7 +85,7 @@ How to use static typing
------------------------
To define the type of a variable or a constant, write a colon after the
variables name, followed by its type. E.g. ``var health: int``. This
variable's name, followed by its type. E.g. ``var health: int``. This
forces the variable's type to always stay the same:
::
@@ -169,7 +169,7 @@ to use this type. This forces the variable to stick to the
player.damage()
As were dealing with a custom type, if the ``body`` doesnt extend
As we're dealing with a custom type, if the ``body`` doesn't extend
``PlayerController``, the ``player``\ variable will be set to ``null``.
We can use this to check if the body is the player or not. We will also
get full autocompletion on the player variable thanks to that cast.
@@ -184,15 +184,15 @@ Safe lines
You can also use casting to ensure safe lines. Safe lines are a new
tool in Godot 3.1 to tell you when ambiguous lines of code are
type-safe. As you can mix and match typed and dynamic code, at times,
Godot doesnt have enough information to know if an instruction will trigger
Godot doesn't have enough information to know if an instruction will trigger
an error or not at runtime.
This happens when you get a child node. Lets take a timer for example:
This happens when you get a child node. Let's take a timer for example:
with dynamic code, you can get the node with ``$Timer``. GDScript
supports `duck-typing <https://stackoverflow.com/a/4205163/8125343>`__,
so even if your timer is of type ``Timer``, it is also a ``Node`` and an
``Object``, two classes it extends. With dynamic GDScript, you also
dont care about the nodes type as long as it has the methods you need
don't care about the node's type as long as it has the methods you need
to call.
You can use casting to tell Godot the type you expect when you get a
@@ -249,12 +249,12 @@ Typed or dynamic: stick to one style
Typed GDScript and dynamic GDScript can coexist in the same project. But
I recommended to stick to either style for consistency in your codebase,
and for your peers. Its easier for everyone to work together if you
and for your peers. It's easier for everyone to work together if you
follow the same guidelines, and faster to read and understand other
peoples code.
people's code.
Typed code takes a little more writing, but you get the benefits we
discussed above. Heres an example of the same, empty script, in a
discussed above. Here's an example of the same, empty script, in a
dynamic style:
::
@@ -283,8 +283,8 @@ And with static typing:
func _process(delta: float) -> void:
pass
As you can see, you can also use types with the engines virtual
methods. Signal callbacks, like any methods, can also use types. Heres
As you can see, you can also use types with the engine's virtual
methods. Signal callbacks, like any methods, can also use types. Here's
a ``body_entered`` signal in a dynamic style:
::
@@ -299,7 +299,7 @@ And the same callback, with type hints:
func _on_area_entered(area: CollisionObject2D) -> void:
pass
Youre free to replace, e.g. the ``CollisionObject2D``, with your own type,
You're free to replace, e.g. the ``CollisionObject2D``, with your own type,
to cast parameters automatically:
::
@@ -312,13 +312,13 @@ to cast parameters automatically:
The ``bullet`` variable could hold any ``CollisionObject2D`` here, but
we make sure it is our ``Bullet``, a node we created for our project. If
its anything else, like an ``Area2D``, or any node that doesnt extend
it's anything else, like an ``Area2D``, or any node that doesn't extend
``Bullet``, the ``bullet`` variable will be ``null``.
Warning system
--------------
The warning system complements typed GDScript. Its here to help you
The warning system complements typed GDScript. It's here to help you
avoid mistakes that are hard to spot during development, and that may
lead to runtime errors.
@@ -331,7 +331,7 @@ called ``GDScript``:
warning system project settings
You can find a list of warnings for the active GDScript file in the
script editors status bar. The example below has 3 warnings:
script editor's status bar. The example below has 3 warnings:
.. figure:: ./img/typed_gdscript_warning_example.png
:alt: warning system example
@@ -340,8 +340,8 @@ script editors status bar. The example below has 3 warnings:
To ignore specific warnings in one file, insert a special comment of the
form ``# warning-ignore:warning-id``, or click on the ignore link to the
right of the warnings description. Godot will add a comment above the
corresponding line and the code wont trigger the corresponding warning
right of the warning's description. Godot will add a comment above the
corresponding line and the code won't trigger the corresponding warning
anymore:
.. figure:: ./img/typed_gdscript_warning_system_ignore.png
@@ -353,10 +353,10 @@ You can also choose to ignore not just one but all warnings of a certain
type in this file with ``# warning-ignore-all:warning-id``. To ignore all
warnings of all types in a file add the comment ``# warnings-disable`` to it.
Warnings wont prevent the game from running, but you can turn them into
errors if youd like. This way your game wont compile unless you fix
Warnings won't prevent the game from running, but you can turn them into
errors if you'd like. This way your game won't compile unless you fix
all warnings. Head to the ``GDScript`` section of the Project Settings to
turn on this option. Heres the same file as the previous example with
turn on this option. Here's the same file as the previous example with
warnings as errors turned on:
.. figure:: ./img/typed_gdscript_warning_system_errors.png
@@ -364,27 +364,27 @@ warnings as errors turned on:
warnings as errors
Cases where you cant specify types
Cases where you can't specify types
-----------------------------------
To wrap up this introduction, lets cover a few cases where you cant
To wrap up this introduction, let's cover a few cases where you can't
use type hints. All the examples below **will trigger errors**.
You cant use Enums as types:
You can't use Enums as types:
::
enum MoveDirection {UP, DOWN, LEFT, RIGHT}
var current_direction: MoveDirection
You cant specify the type of individual members in an array. This will
You can't specify the type of individual members in an array. This will
give you an error:
::
var enemies: Array = [$Goblin: Enemy, $Zombie: Enemy]
You cant force the assignment of types in a ``for`` loop, as each
You can't force the assignment of types in a ``for`` loop, as each
element the ``for`` keyword loops over already has a different type. So you
**cannot** write:
@@ -394,7 +394,7 @@ element the ``for`` keyword loops over already has a different type. So you
for name: String in names:
pass
Two scripts cant depend on each other in a cyclic fashion:
Two scripts can't depend on each other in a cyclic fashion:
::

View File

@@ -1,6 +1,6 @@
.. _doc_custom_visualscript_nodes:
Custom VisualScript Nodes
Custom VisualScript nodes
=========================
Custom nodes are written in GDScript and can then be used in VisualScript.

View File

@@ -1,6 +1,6 @@
.. _doc_godot_design_philosophy:
Godots design philosophy
Godot's design philosophy
=========================
Now that you've gotten your hands wet, let's talk about Godot's design.
@@ -8,7 +8,7 @@ Now that you've gotten your hands wet, let's talk about Godot's design.
**Every game engine is different and fits different needs.**
Not only do they offer a range of features, but the design of each engine
is unique. This leads to different workflows and different ways to form
your games structures. This all stems from their respective design philosophies.
your games' structures. This all stems from their respective design philosophies.
This page is here to help you understand how Godot works, starting
with some of its core pillars. It is not a list of available features, nor
@@ -36,22 +36,22 @@ BrokenLanterns in the city will update instantly.
On top of that, you can **inherit** from any scene.
A Godot scene could be a Weapon, a Character, an Item, a Door, a Level,
part of a level… anything youd like. It works like a class in pure code,
except youre free to design it by using the editor, using only the
part of a level… anything you'd like. It works like a class in pure code,
except you're free to design it by using the editor, using only the
code, or mixing and matching the two.
Its different from prefabs you find in several 3D engines, as you can
It's different from prefabs you find in several 3D engines, as you can
then inherit from and extend those scenes. You may create a Magician
that extends your Character. Modify the Character in the editor and the Magician
will update as well. It helps you build your projects so that their
structure matches the games design.
structure matches the game's design.
|image0|
Also note that Godot offers many different types of objects called
nodes, each with a specific purpose. Nodes are part of a tree and always
inherit from their parents up to the Node class. Although the engine
does feature components like collision shapes, theyre the
does feature components like collision shapes, they're the
exception, not the norm.
|image1|
@@ -76,8 +76,8 @@ there is an import plugin for it. Or you can create one, like the `Tiled
Map Importer <https://github.com/vnen/godot-tiled-importer>`__.
That is also partly why Godot offers its own programming languages
GDscript and VisualScript, along with C#. Theyre designed for the needs
of game developers and game designers, and theyre tightly integrated in
GDscript and VisualScript, along with C#. They're designed for the needs
of game developers and game designers, and they're tightly integrated in
the engine and the editor.
GDscript lets you write simple code using Python-like syntax,
@@ -94,9 +94,9 @@ without recompiling the engine.
in the editor. You can drag and drop nodes or resources into the graph
to create new code blocks.*
Note that the 3D workspace doesnt feature as many tools as the 2D workspace.
Youll need external programs or add-ons to edit terrains, animate complex characters, and so on.
Godot provides a complete API to extend the editors functionality using
Note that the 3D workspace doesn't feature as many tools as the 2D workspace.
You'll need external programs or add-ons to edit terrains, animate complex characters, and so on.
Godot provides a complete API to extend the editor's functionality using
game code. See `The Godot editor is a Godot game`_ below.
|image4|
@@ -110,40 +110,40 @@ Open source
Godot offers a fully open source codebase under the **MIT license**.
This means all the technologies that ship with it have to be Free
(as in freedom) as well.
For the most part, theyre developed from the ground up by contributors.
For the most part, they're developed from the ground up by contributors.
Anyone can plug in proprietary tools for the needs of their projects —
they just wont ship with the engine. This may include Google AdMob,
they just won't ship with the engine. This may include Google AdMob,
or FMOD. Any of these can come as
third-party plugins instead.
On the other hand, an open codebase means you can **learn from and extend
the engine** to your hearts content. You can also debug games easily,
the engine** to your heart's content. You can also debug games easily,
as Godot will print errors with a stack trace, even if they come from the engine itself.
.. note::
This **does not affect the work you do with Godot** in any way: theres
This **does not affect the work you do with Godot** in any way: there's
no strings attached to the engine or anything you make with it.
Community-driven
----------------
**Godot is made by its community, for the community, and for all game
creators out there.** Its the needs of the users and open discussions
creators out there.** It's the needs of the users and open discussions
that drive the core updates. New features from the core developers often
focus on what will benefit the most users first.
That said, although a handful of core developers work on it full-time,
the project has over 600 contributors at the time of writing. Benevolent
programmers work on features they may need themselves, so youll see
programmers work on features they may need themselves, so you'll see
improvements in all corners of the engine at the same time in every
major release.
The Godot editor is a Godot game
--------------------------------
The Godot editor runs on the game engine. It uses the engines own UI
The Godot editor runs on the game engine. It uses the engine's own UI
system, it can hot-reload code and scenes when you test your projects,
or run game code in the editor. This means you can **use the same code**
and scenes for your games, or **build plugins and extend the editor.**
@@ -153,7 +153,7 @@ itself. With the ``tool`` keyword, you can run any game code in the editor.
|image5|
*RPG in a Box is a voxel RPG editor made with Godot 2. It uses Godots
*RPG in a Box is a voxel RPG editor made with Godot 2. It uses Godot's
UI tools for its node-based programming system and for the rest of the
interface.*

View File

@@ -1,16 +1,16 @@
.. _doc_intro_to_the_editor_interface:
Introduction to Godots editor
Introduction to Godot's editor
==============================
This tutorial will run you through Godots interface. Were going to
This tutorial will run you through Godot's interface. We're going to
look at the **Project Manager, docks, workspaces** and everything you
need to know to get started with the engine.
Project manager
---------------
When you launch Godot, the first window youll see is the Project
When you launch Godot, the first window you'll see is the Project
Manager. Since you have no projects there will be a popup asking if you
want to open the asset library, just click cancel, we'll look at it later.
@@ -21,8 +21,8 @@ or play game projects.
.. image:: img/editor_ui_intro_project_manager_01.png
In the top-right corner youll find a drop-down menu to change the
editors language.
In the top-right corner you'll find a drop-down menu to change the
editor's language.
.. image:: img/editor_ui_intro_project_manager_02.png
@@ -43,8 +43,8 @@ and choose a renderer.
.. image:: img/editor_ui_intro_project_manager_04.png
Click the Browse button to open Godots file browser and pick a location
or type the folders path in the Project Path field.
Click the Browse button to open Godot's file browser and pick a location
or type the folder's path in the Project Path field.
.. image:: img/editor_ui_intro_project_manager_05.png
@@ -61,7 +61,7 @@ later on. For this tutorial either backend is fine.
Once you are done click ``Create & Edit``. Godot will create
the project for you and open it in the editor.
The next time you open the project manager, youll see your new project in the
The next time you open the project manager, you'll see your new project in the
list. Double click on it to open it in the editor.
.. image:: img/editor_ui_intro_project_manager_06.png
@@ -76,10 +76,10 @@ When the folder path is correct, you'll see a green checkmark.
.. image:: img/editor_ui_intro_project_manager_09.png
Your first look at Godots editor
Your first look at Godot's editor
---------------------------------
Welcome to Godot! With your project open, you should see the editors interface
Welcome to Godot! With your project open, you should see the editor's interface
with menus along the top of the interface and docks along the far extremes of
the interface on either side of the viewport.
@@ -88,24 +88,24 @@ the interface on either side of the viewport.
At the top, from left to right, you can see the **main menus**, the
**workspaces**, and the **playtest buttons**.
The **FileSystem dock** is where youll manage your project files and assets.
The **FileSystem dock** is where you'll manage your project files and assets.
.. image:: img/editor_ui_intro_dock_filesystem.png
The **Scene dock** lists the active scenes content and the **Inspector**
The **Scene dock** lists the active scene's content and the **Inspector**
allows for the management of the properties of a scene's content.
.. image:: img/editor_ui_intro_dock_inspector.png
In the center, you have the **Toolbar** at the top, where youll find
tools to move, scale or lock your scenes objects. It changes as you
In the center, you have the **Toolbar** at the top, where you'll find
tools to move, scale or lock your scene's objects. It changes as you
jump to different workspaces.
.. image:: img/editor_ui_intro_editor_02_toolbar.png
The **Bottom Panel** is the host for the debug console, the animation
editor, the audio mixer… They are wide and can take precious space.
Thats why theyre folded by default.
That's why they're folded by default.
.. image:: img/editor_ui_intro_editor_03_animation_player.png
@@ -115,7 +115,7 @@ The workspaces
You can see four workspace buttons at the top: 2D, 3D, Script and
AssetLib.
Youll use the **2D workspace** for all types of games. In addition to 2D games,
You'll use the **2D workspace** for all types of games. In addition to 2D games,
the 2D workspace is where you'll build your interfaces. Press :kbd:`F1`
(or :kbd:`Alt + 1` on macOS) to access it.
@@ -161,7 +161,7 @@ and assets to use in your projects.
Modify the interface
--------------------
Godots interface lives in a single window. You cannot split it across
Godot's interface lives in a single window. You cannot split it across
multiple screens although you can work with an external code editor like
Atom or Visual Studio Code for instance.

View File

@@ -625,9 +625,9 @@ find the final project here: :download:`ui_gui_design.zip <files/ui_gui_design.z
**A final note about Responsive Design**. If you resize the
GUI, you'll see the nodes move, but the textures and text won't scale.
The GUI also has a minimum size, based on the textures inside of it. In
games, we dont need the interface to be as flexible as that of a
games, we don't need the interface to be as flexible as that of a
website. You almost never want to support both landscape and portrait
screen orientations. Its one or the other. In landscape orientation,
screen orientations. It's one or the other. In landscape orientation,
the most common ratios range from 4:3 to 16:9. They are close to one
another. That's why its enough for the GUI elements to only move
another. That's why it's enough for the GUI elements to only move
horizontally when we change the window size.

View File

@@ -28,7 +28,7 @@ folder.
.. note::
Read the :doc:`ui_introduction_to_the_ui_system` first to learn how
Godots UI system works.
Godot's UI system works.
How to design your game UI
--------------------------
@@ -70,7 +70,7 @@ There are two ways to design your UI in Godot. You can:
components that inherit from your base scenes.
We will use the first approach, because the first version of your UI may
not work as well as youd like. Youre likely to throw parts away and
not work as well as you'd like. You're likely to throw parts away and
redesign components as you go. When you're sure everything works, it's
easy to make some parts reusable, as you'll see below.
@@ -150,7 +150,7 @@ Select the ``MarginContainer``, and create the UI elements as
1. the title or logo,
2. the three text options as individual nodes,
3. the version note,
4. and the main menus illustration.
4. and the main menu's illustration.
Click the **Add Node** button or press :kbd:`Meta + A` on your keyboard.
Start to type ``TextureRect`` to find the corresponding node and press

View File

@@ -1216,7 +1216,7 @@ and ``$Music.stop()`` in the ``game_over()`` function.
Finally, add ``$DeathSound.play()`` in the ``game_over()`` function.
Keyboard Shortcut
Keyboard shortcut
~~~~~~~~~~~~~~~~~
Since the game is played with keyboard controls, it would be convenient if we

View File

@@ -31,7 +31,7 @@ with extension ``.pck``).
- offer mod support
- no source code disclosure needed for mods
- more modular project structure
- users dont have to replace the entire game
- users don't have to replace the entire game
The first part of using them involves exporting and delivering the project to
players. Then, when one wants to add functionality or content later on, they

View File

@@ -106,7 +106,7 @@ the node's lock button:
.. image:: img/tile_lock.png
Collision Shapes
Collision shapes
----------------
If you're making a map that needs collisions - walls, floor, or other obstacles,

View File

@@ -577,7 +577,7 @@ to make the compiler understand for what the uniform is used.
uniform float amount : hint_range(0, 1);
uniform vec4 other_color : hint_color = vec4(1.0);
It's important to understand that textures that are supplied as color require hints for proper sRGB->linear conversion (i.e. ``hint_albedo``), as Godots 3D engine renders in linear color space.
It's important to understand that textures that are supplied as color require hints for proper sRGB->linear conversion (i.e. ``hint_albedo``), as Godot's 3D engine renders in linear color space.
Full list of hints below: