Improve Creating your first script page

- Add godot.svg icon according to comment.
- Update link to intro section based on comment.
- Update some styling to match current guidelines.
This commit is contained in:
tetrapod00
2025-02-09 17:25:03 -08:00
parent 058f0f65ba
commit 45ba52453e
3 changed files with 21 additions and 15 deletions

View File

@@ -84,7 +84,7 @@ Software Development Kits (SDK) in the engine.
Of course, you can also directly add modules and features to the engine, as it's
completely free and open source.
.. doc_learning_programming
.. _doc_introduction_learning_programming:
What do I need to know to use Godot?
------------------------------------

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

View File

@@ -4,7 +4,7 @@
- Giving a *short* and sweet hands-on intro to GDScript. The page should
focus on working in the code editor.
- We assume the reader has programming foundations. If you don't, consider
taking the course we recommend in the :ref:`introduction to Godot page <doc_learning_programming>`.
taking the course we recommend in the :ref:`introduction to Godot page <doc_introduction_learning_programming>`.
Techniques:
@@ -19,9 +19,12 @@ Creating your first script
==========================
In this lesson, you will code your first script to make the Godot icon turn in
circles using GDScript. As we mentioned :ref:`in the introduction
<toc-learn-introduction>`, we assume you have programming foundations.
The equivalent C# code has been included in another tab for convenience.
circles. As we mentioned :ref:`in the introduction
<doc_introduction_learning_programming>`, we assume you have programming
foundations.
This tutorial is written for GDScript, and the equivalent C# code is included in
another tab of each codeblock for convenience.
.. image:: img/scripting_first_script_rotating_godot.gif
@@ -37,10 +40,10 @@ Please :ref:`create a new project <doc_creating_and_importing_projects>` to
start with a clean slate. Your project should contain one picture: the Godot
icon, which we often use for prototyping in the community.
.. Godot icon
.. image:: img/scripting_first_script_icon.svg
We need to create a Sprite2D node to display it in the game. In the Scene dock,
click the Other Node button.
click the **Other Node** button.
.. image:: img/scripting_first_script_click_other_node.webp
@@ -54,7 +57,7 @@ Your Scene tab should now only have a Sprite2D node.
.. image:: img/scripting_first_script_scene_tree.webp
A Sprite2D node needs a texture to display. In the Inspector on the right, you
can see that the Texture property says "[empty]". To display the Godot icon,
can see that the **Texture** property says ``<empty>``. To display the Godot icon,
click and drag the file ``icon.svg`` from the FileSystem dock onto the Texture
slot.
@@ -73,15 +76,16 @@ Creating a new script
---------------------
To create and attach a new script to our node, right-click on Sprite2D in the
scene dock and select "Attach Script".
Scene dock and select **Attach Script**.
.. image:: img/scripting_first_script_attach_script.webp
The Attach Node Script window appears. It allows you to select the script's
The **Attach Node Script** window appears. It allows you to select the script's
language and file path, among other options.
Change the Template field from "Node: Default" to "Object: Empty" to start with a clean file. Leave the
other options set to their default values and click the Create button to create the script.
Change the **Template** field from ``Node: Default`` to ``Object: Empty`` to
start with a clean file. Leave the other options set to their default values and
click the **Create** button to create the script.
.. image:: img/scripting_first_script_attach_node_script.webp
@@ -246,9 +250,10 @@ our sprite's rotation every frame. Here, ``rotation`` is a property inherited
from the class ``Node2D``, which ``Sprite2D`` extends. It controls the rotation
of our node and works with radians.
.. tip:: In the code editor, you can Ctrl-click (Cmd-click on MacOS) on any built-in property or
function like ``position``, ``rotation``, or ``_process`` to open the
corresponding documentation in a new tab.
.. tip:: In the code editor, you can :kbd:`Ctrl + Click` (:kbd:`Cmd + Click` on
macOS) on any built-in property or function like ``position``,
``rotation``, or ``_process`` to open the corresponding documentation
in a new tab.
Run the scene to see the Godot icon turn in-place.