Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Question?????
- KINGSCRATCHATMADDEN
-
Scratcher
16 posts
Question?????
Does anyone know how to make the letters be typed onto the screen?
- musicROCKS013
-
Scratcher
1000+ posts
Question?????
You could make a text engine or use one that is already pre made. I would recommend -Rex- ‘s pen text engine. You could also make a costume and type text on the costume.
- RL1123
-
Scratcher
1000+ posts
Question?????
The simplest way to get letters onto the screen is to use the ask block. It'll then let you type letters into a text box.
However, if you want to put letters onto your screen based on a sprite and not just a text box, it's much more complex. Before you do the code below, you need to have a sprite with all the letters in it with the costume names being from a to z. So, the screenshot below shows what it should look like.

Then after you have the entire alphabet, you should create a custom block with this checked off at the bottom:

Now, you can use the script below:
And that's mostly the basics.
ask [] and wait
However, if you want to put letters onto your screen based on a sprite and not just a text box, it's much more complex. Before you do the code below, you need to have a sprite with all the letters in it with the costume names being from a to z. So, the screenshot below shows what it should look like.

Then after you have the entire alphabet, you should create a custom block with this checked off at the bottom:

Now, you can use the script below:
define Write Letters
set [letters v] to [abcdefghijklmnopqrstuvwxyz]
set [index v] to [1]
repeat (26)
if <key (letter (index) of (letters)) pressed?> then
set x to (20) // this should be how wide your letter costume is, in this case its 20 pixels
switch costume to (letter (index) of (letters))
show
stamp // this uses the pen extension, make sure to get that
end
end
hide
when green flag clicked
go to x: (0) y: (0)
forever
Write Letters
end
And that's mostly the basics.
Last edited by RL1123 (May 8, 2022 04:04:21)
- KINGSCRATCHATMADDEN
-
Scratcher
16 posts
Question?????
I don't have exams hurray never had them before.Thx for your help that will help me on a animation i am making.
- Discussion Forums
- » Help with Scripts
-
» Question?????