Text Engine: различия между версиями

Материал из Поле цифровой дидактики
м (1 версия импортирована)
 
(не показана 1 промежуточная версия этого же участника)
Строка 1: Строка 1:
{{merge|Text Rendering|date=January 2021}}
{{stub|date=April 2021}}
'''Text Engines''' have several uses in Scratch. One common reason a text engine is used for [[dialog]].
'''Text Engines''' have several uses in Scratch. One common reason a text engine is used for [[dialog]].


Строка 22: Строка 20:
</scratchblocks>
</scratchblocks>


{{note|There is an issue with this custom block. When a character talks, it will chop out the first letter of the text. To fix this issue, add a space before the text. If that does not work, add another letter to it.}}
* There is an issue with this custom block. When a character talks, it will chop out the first letter of the text. To fix this issue, add a space before the text. If that does not work, add another letter to it.


[[Category:Scripting Tutorials]]
[[Category:Scripting Tutorials]]

Текущая версия на 08:26, 11 ноября 2023

Text Engines have several uses in Scratch. One common reason a text engine is used for dialog.

Creating The Engine

Code

The code is fairly simple, but a little hard to follow/understand.

define Player Dialogue Block (Text) (Text Timer)
set [Numbers# v] to (1)
set [Word v] to ()
repeat (length of (Text))
change [Numbers# v] by (1)
say (join (Word) (letter (Number#) of (Text)
set [Word v] to (join (Word) (letter (Number#) of (Text)
wait (0.05) seconds
end
wait (Text Timer) seconds//how long the text is displayed
say ()
  • There is an issue with this custom block. When a character talks, it will chop out the first letter of the text. To fix this issue, add a space before the text. If that does not work, add another letter to it.