mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
replace %% for `
parent
818f464744
commit
9dfa7327d6
18
gdscript.md
18
gdscript.md
@ -105,23 +105,23 @@ The following is the list of supported operators and their precedence (TODO, cha
|
||||
|
||||
| Operator | Description |
|
||||
| -------- | ----------- |
|
||||
| %%x[index]%% | Subscription, Highest Priority |
|
||||
| `x[index]` | Subscription, Highest Priority |
|
||||
| x.attribute | Attribute Reference |
|
||||
| extends | Instance Type Checker |
|
||||
| %%~%% | Bitwise NOT |
|
||||
| `~` | Bitwise NOT |
|
||||
| -x | Negative |
|
||||
| * / % | Mult / Div / Remainder |
|
||||
| + - | Addition / Substraction |
|
||||
| %%<< >>%% | Bit Shifting |
|
||||
| `<< >>` | Bit Shifting |
|
||||
| & | Bitwise AND |
|
||||
| %%^%% | Bitwise XOR |
|
||||
| %% | %% | Bitwise OR |
|
||||
| %%< > == != >= <=%% | Comparisons |
|
||||
| `^` | Bitwise XOR |
|
||||
| ` | ` | Bitwise OR |
|
||||
| `< > == != >= <=` | Comparisons |
|
||||
| in | Content Test |
|
||||
| %%! not%% | Boolean NOT |
|
||||
| `! not` | Boolean NOT |
|
||||
| and && | Boolean AND |
|
||||
| or %% | | %% | Boolean OR |
|
||||
| %%= += -= *= /= %= &= | =%% | Assignment, Lowest Priority |
|
||||
| or ` | | ` | Boolean OR |
|
||||
| `= += -= *= /= %= &= | =` | Assignment, Lowest Priority |
|
||||
|
||||
## Literals
|
||||
|
||||
|
@ -16,11 +16,11 @@ Translators also, most of the time prefer to work with spreadsheets (either as a
|
||||
|
||||
To complete the picture and allow efficient support for translations, Godot has a special importer that can read .csv files. Both Microsoft Excel and Google Spreadsheet can export to this format, so the only requirement is that the files have a special format. The csv files must be saved in utf-8 encoding and the format is as follows:
|
||||
|
||||
| | %%<lang1>%% | %%<lang2>%% | %%<langN>%% |
|
||||
| | `<lang1>` | `<lang2>` | `<langN>` |
|
||||
| | ----------- | ----------- | ----------- |
|
||||
| KEY1 | %%string%%| %%string%%|%%string%%|
|
||||
| KEY2 | %%string%%| %%string%%|%%string%%|
|
||||
| KEYN | %%string%%| %%string%%|%%string%%|
|
||||
| KEY1 | `string`| `string`|`string`|
|
||||
| KEY2 | `string`| `string`|`string`|
|
||||
| KEYN | `string`| `string`|`string`|
|
||||
|
||||
The "lang" tags must represent a language, it must be one of the [valid locales](locales) supported by the engine. The "KEY" tags must be unique and represent a string universally (they are usually in uppercase, to differentiate from other strings). Here's an example:
|
||||
|
||||
|
@ -33,7 +33,7 @@ The language is statically type and only supports a few operations. Arrays, clas
|
||||
|
||||
#### Syntax
|
||||
|
||||
The syntax is similar to C, with statements ending in ; , and comments as %%// and /* */%%.
|
||||
The syntax is similar to C, with statements ending in ; , and comments as `// and /* */`.
|
||||
Example:
|
||||
|
||||
:::C
|
||||
@ -132,7 +132,7 @@ Example:
|
||||
| vec_type **clamp**( vec_type value,vec_type min, vec_type max ) | Clamp to Min-Max |
|
||||
| vec_type **mix**( vec_type a,vec_type b, float c ) | Linear Interpolate |
|
||||
| vec_type **mix**( vec_type a,vec_type b, vec_type c ) | Linear Interpolate (Vector Coef.)|
|
||||
| vec_type **step**( vec_type a,vec_type b) | %% a[i] < b[i] ? 0.0 : 1.0%%|
|
||||
| vec_type **step**( vec_type a,vec_type b) | ` a[i] < b[i] ? 0.0 : 1.0`|
|
||||
| float **length**( vec_type ) | Vector Length |
|
||||
| float **distance**( vec_type, vec_type ) | Distance between vector. |
|
||||
| float **dot**( vec_type, vec_type ) | Dot Product |
|
||||
|
@ -36,15 +36,15 @@ Godot only supports "/" as a directory delimiter. This is done for portability r
|
||||
|
||||
### Resource Path
|
||||
|
||||
For accessing resources, using the host OS filesystem layout can be cumbersome and non portable. To solve this problem, the specal path %%"res://"%% was created.
|
||||
For accessing resources, using the host OS filesystem layout can be cumbersome and non portable. To solve this problem, the specal path `"res://"` was created.
|
||||
|
||||
The path %%"res://"%% will always point at the project root (where engine.cfg is located, so in fact %%"res://engine.cfg"%% is always valid).
|
||||
The path `"res://"` will always point at the project root (where engine.cfg is located, so in fact `"res://engine.cfg"` is always valid).
|
||||
|
||||
This filesystem is read-write only when running the project locally from the editor. When exported or when running on different devices (such as phones or consoles, or running from DVD), the filesystem will become read-only and writing will no longer be permitted.
|
||||
|
||||
### User Path
|
||||
|
||||
Writing to disk is still needed often, from doing a savegame to downloading content packs. For this, the engine ensures that there is a special path %%"user://"%% that is always writable.
|
||||
Writing to disk is still needed often, from doing a savegame to downloading content packs. For this, the engine ensures that there is a special path `"user://"` that is always writable.
|
||||
|
||||
### Host Filesystem
|
||||
|
||||
|
@ -30,7 +30,7 @@ Pressing the the ">" button the right side of the preview, allows to view and ed
|
||||
|
||||
When the resource comes from a file, it is considered an *external* resource. If the path property is erased (or never had a path o begin with), it is then considered a built-in resource.
|
||||
|
||||
For example, if the path %%"res://robi.png"%% is erased from the "path" property in the above example, and then the scene is saved, the resource will be saved inside the .scn scene file, no longer referencing the external "robi.png". However, even if saved as built-in, and even though the scene can be instanced multiple times, the resource will still always be loaded once. That means, different Robi robot scenes instanced at the same time will still share the same image.
|
||||
For example, if the path `"res://robi.png"` is erased from the "path" property in the above example, and then the scene is saved, the resource will be saved inside the .scn scene file, no longer referencing the external "robi.png". However, even if saved as built-in, and even though the scene can be instanced multiple times, the resource will still always be loaded once. That means, different Robi robot scenes instanced at the same time will still share the same image.
|
||||
|
||||
### Loading Resources from Code
|
||||
|
||||
|
@ -99,7 +99,7 @@ Scenes need to be saved to be run, so save the scene to something like hello.scn
|
||||
|
||||
<p align="center"><img src="images/savescene.png"></p>
|
||||
|
||||
And here's when something funny happens. The file dialog is a special file dialog, and only allows to save inside the project. %%The project root is "res://" which means "resource path. This means that files can only be saved inside the project. For the future, when doing file operations in Godot, remember that "res://" is the resource path, and no matter the platform or install location, it is the way to locate where resource files are from inside the game.%%
|
||||
And here's when something funny happens. The file dialog is a special file dialog, and only allows to save inside the project. `The project root is "res://" which means "resource path. This means that files can only be saved inside the project. For the future, when doing file operations in Godot, remember that "res://" is the resource path, and no matter the platform or install location, it is the way to locate where resource files are from inside the game.`
|
||||
|
||||
After saving the scene and pressing run scene again, the "Hello, World!" demo should finally execute:
|
||||
|
||||
|
@ -8,7 +8,7 @@ The scene system is very useful, but by itself it has a few drawbacks:
|
||||
|
||||
* There is no "common" place to store information (such as core, items obtained, etc) between two scenes.
|
||||
* It is possible to make a scene that loads other scenes as children and frees them, while keeping that information, but then if that is done, it's not possible to run a scene alone by itself and expect it to work
|
||||
* It is also possible to store persistent information to disk in %%user://%% and have scenes always load it, but saving/loading that while changing scenes is cumbersome.
|
||||
* It is also possible to store persistent information to disk in `user://` and have scenes always load it, but saving/loading that while changing scenes is cumbersome.
|
||||
|
||||
So, after using Godot for a while, it becomes clear that it is necessary to have parts of a scene that:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user