|This article or section may not have content matching Scratch Wiki editing standards. Please improve it according to Scratch Wiki:Guidelines and Scratch Wiki:Editing Conventions. (December 2016)|
Reason: Not a proper guide
|This page or section is in question as to whether it is useful or not. You can discuss whether you want it deleted or not on its talk page.|
Operating system projects have been made by many Scratchers. Scratch does not have the capability to create a true operating system. However, it is possible to mimic one.
Begin with creating sprites as shown:
- Loading sprite (optional)
- Logo (optional)
- Password Manager (optional)
- Application (Games, apps, etc.)
One can also add other sprites, like a menu sprite.
Fading in can be used as a transition. This is a way of making a fade in effect using the ghost effect block:
when gf clicked set [ghost v] effect to (100) repeat (25) change [ghost v] effect by (-4) end
Fading out can also be used as an ending effect. This is a script for a fade-out effect:
when gf clicked set [ghost v] effect to (0) repeat (25) change [ghost v] effect by (4) end
These transitions use one of the Graphic Effect blocks called the Ghost Effect.
To create certain movements, some operating systems use physics. To do this, first, create a variable called x velocity or something similar. This variable will calculate the x velocity.
Now, write the following script:
when gf clicked set [x velocity v] to  repeat (50) change x by (x velocity) set [x velocity v] to ((x velocity)-(0.1)) end
As the velocity reduces, the speed of the object reduces. So, eventually, the object will come to a smooth halt. Every time the function is called, the velocity will reduce by 0.1. The user can then edit the script to their needs.
Some operating systems contain loading screens. To make a loading screen, first, create a sprite with different costumes for loading. Then, one could use this script to make a loading screen:
when I receive [load v] show repeat (pick random (1) to (20)) wait (0.3) secs next costume end hide broadcast (password v)
Another idea is to create a logo for the project. Try to make a logo that represents the project. When the logo is made, this script will make it show/hide at the appropriate time. One also may want to use the smooth transitions and fade in/out effect for this.
when gf clicked show when I receive [password v] hide
One can add a password to an OS. To make one, create a variable called
(password). Then, place these scripts:
when gf clicked set [password v] to  // insert any text
After setting the password, place these scripts:
when I receive [password v] ask [Password please] and wait if <(answer) = (password)> then // If the password is correct, it loads say [Loading…] for (pick random (1) to (8)) secs broadcast (OS Complete v) else say [Sorry, please try again.] for (2) secs broadcast (password v) // this will re-run this script
when I receive [OS Complete v] ... // these scripts will run if the password is correct
Or, this workaround can be used:
repeat until <(answer) = (password)> ask [Password please] and wait end say [Loading...] for (pick random (1) to (8)) secs broadcast (OS Complete v)
What the script does is it asks the user to enter the password the user set. If it is correct, it will go to the loading screen and load the operating system. But if the password is wrong, it will say the user will have to log in again.
|Caution:||These passwords are not private. A user can see the passwords by clicking the "See Inside" button on the project page.|
|Note:||Remember to leave the manager sprite blank.|
Applications or programs are the main part of an OS. They can range from pong games to music to chatbots. Being unique in their applications will help make their OS stick out. A good suggestion would be to add an advanced game, make minigames, and add music to start, and add more if the user chooses to.
When all of the apps are created, replace all
when gf clicked with
when I receive [message1 v]. This can reduce lag. Make sure that the script
when gf clicked broadcast (message1 v)
is somewhere in your project.
|Note:||The script above should be within the apps.|
Real Operating Systems
This tutorial explains how to create a Scratch project with the stereotypical user interface of an operating system, but the project does not actually simulate or emulate an operating system. Real operating systems involve many different parts, such as the bootloader and kernel, and may not necessarily support a GUI. The most common operating systems include Windows, Mac OS, Linux, Chrome OS, FreeBSD, Android, or a platform-specific version of iOS.