-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
lesson-22-functions-return-values.pot
173 lines (154 loc) · 6.07 KB
/
lesson-22-functions-return-values.pot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# Translations template for Learn GDScript From Zero.
# Copyright (C) 2024 GDQuest
# This file is distributed under the same license as the Learn GDScript From
# Zero project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Learn GDScript From Zero \n"
"Report-Msgid-Bugs-To: https://github.com/GDQuest/learn-gdscript\n"
"POT-Creation-Date: 2024-12-12 14:39+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.1\n"
#: course/lesson-22-functions-return-values/lesson.tres:13
msgid ""
"Until now, you learned that functions are sequences of instructions you "
"give a name and you can call any time.\n"
"\n"
"On top of that, functions can make calculations and [i]return[/i] new "
"values.\n"
"\n"
"Let's look at some examples to see why it's useful."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:25
msgid "Built-in functions that return a value"
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:27
msgid ""
"Many functions built into GDScript make calculations and return a new "
"value.\n"
"\n"
"For example, the [code]round()[/code] function takes a decimal number as "
"an argument and gives you back a new number rounded to the nearest digit."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:49
msgid ""
"Imagine you have a game where you track the player's health as a "
"percentage, a decimal number going from [code]0.0[/code] to "
"[code]100.0[/code].\n"
"\n"
"When displaying the health on the interface, you don't want to show the "
"decimal part. In that case, you may use the [code]round()[/code] "
"function, like so."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:71
msgid ""
"Notice how we assign the result of the function call to a variable. "
"Because the [code]round()[/code] function returns a [i]new[/i] value, we "
"need to either store the result or use the value immediately.\n"
"\n"
"Above, we assigned it to a variable, but you could also do the following."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:93
msgid ""
"You can assign the return value of a function call if you plan on using "
"it more than once."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:101
msgid "A cooler example: lerp()"
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:103
msgid ""
"The [code]lerp()[/code] function, short for [i]linear interpolate[/i], "
"calculates and returns a weighted average between two values.\n"
"\n"
"It takes three arguments: the two values to average and a value between "
"[code]0.0[/code] and [code]1.0[/code] to skew the result.\n"
"\n"
"In game programming, it's used to animate things moving towards a target "
"with a single line of code."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:137
msgid ""
"Every frame, the code calculates a position somewhere between the turtle "
"and the mouse cursor. The [code]lerp()[/code] function takes care of "
"everything.\n"
"\n"
"It's not the most robust approach for smooth movement, as you'll learn in"
" the future, but it's a helpful function nonetheless."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:147
msgid "Writing a function that returns a value"
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:149
msgid ""
"You can make [i]your[/i] functions return values.\n"
"\n"
"To make a function return a value, you use the [code]return[/code] "
"keyword followed by the value in question.\n"
"\n"
"In previous lessons, we had characters walking on grids.\n"
"\n"
"And for those practices, you were working directly with cell coordinates."
"\n"
"\n"
"Well, cell coordinates don't correspond to positions on the screen. To "
"find the center of any cell on the screen, we need to convert the cell's "
"coordinates to a position on the screen, in pixels."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:177
msgid ""
"To do so, we use a function. The function does two things:\n"
"\n"
"1. First, it multiplies the cell coordinates by the cell size, which "
"gives us the position of the cell's top-left corner on the screen, in "
"pixels.\n"
"2. Then, we add half of the cell size to get the center of the cell.\n"
"\n"
"The function returns the result, allowing us to store it in a variable."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:202
msgid ""
"The [code]return[/code] keyword returns the value to the code calling the"
" function. You'll receive the result where you call the function."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:222
msgid ""
"Some functions return values, and some do not. During practices, you can "
"learn which functions return a value using the documentation panel. It "
"will display if the practice requires using specific functions or "
"variables.\n"
"\n"
"There, functions that start with the term [code]void[/code] do not return"
" a value. Any other term means the function does return a value. You'll "
"learn more about what other terms mean in a couple of lessons when we "
"explore value [i]types[/i].\n"
"\n"
"For now, let's practice returning values from functions!"
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:234
msgid "Converting coordinates from the grid to the screen"
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:235
msgid ""
"Define a function that converts a position on a grid to the screen.\n"
"\n"
"The function takes a [code]Vector2[/code] cell coordinate as an argument."
" It should return the corresponding [code]Vector2[/code] screen "
"coordinates at the center of the cell."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:249
msgid ""
"We lost the function to convert grid coordinates, but we desperately need"
" it for our game! Make the turtle move again by coding it."
msgstr ""
#: course/lesson-22-functions-return-values/lesson.tres:253
msgid "Functions that return a value"
msgstr ""