Eng:How to Make a Typewriter Simulator

A typewriter simulator is a simulation project where you can type notes, like in a word processor. This typewriter tutorial only requires simple scripting.

Creation
First, create a sprite. You can call it whatever you want, but for this example, it will be called "Text".

Now, click the Costumes button above the block palette, and change the mode to vector. You will need to create a new costume with the letter "a", uppercase or lowercase. Name the costume "a".

Create 25 more costumes, but instead of making more "a"s, make one costume for each letter of the alphabet. The name of each costume should be the letter that the costume is.

Once you have all of the costumes, create a custom block that looks like this: print [] size // category=custom

Once you finish, a "Define" hat should appear.

Click the Data button, and create a variable that is open to all sprites and named "letter on?".

Remember the define block that was created earlier? In this step, it will be defined. Snap the following blocks underneath the define block so that the script looks like this:

define print [text] size (size) set [letter on? v] to [1] repeat (length of (text)) switch costume to (letter (letter on?) of (text) stamp change [letter on? v] by (1) change x by (size) end

Now, you have two different choices. You can choose whichever one you like better.

One method of detecting which keys are pressed can be the 26-script way. It's like this:

First, create a script like this:

when [a v] key pressed print [a] size (width of costumes) // category=custom

When using this method, you need to repeat the script 25 more times, but each with a different letter of the alphabet. First "a", then "b", and so on.

Another method of detecting which keys are pressed can be the 1-script way. First, create a script like this:

when gf clicked forever if  print [a] size (width of costumes) // category=custom else

end

The next step is to copy the "if else" part and stick it in the first "if else"'s "else". Change the "" to "" and change the "print [a]..." to "print [b]...". Keep on doing this until you get to "y". This part is different, and should look like this:

... if  print [y] size (width of costumes) // category=custom else if  print [z] size (width of costumes // category=custom end end wait (delay time) secs end forever block // category=control

Conclusion
If you followed all of the above steps, you should now have a working typewriter simulator!