|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 think it should be deleted or not on its talk page. (October 2018)|
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. (Note: this article is quite advanced and includes many sprites)
Begin by creating the sprites for the Operating System, as shown below.
- Loading sprite
- Password Manager
- Games, apps, etc.
One can also add other sprites for example a menu sprite or a user profile picture 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) change [x velocity v] by [-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.
You can also do this with sizes. To make an object bigger when your mouse is hovering over it, you can write this script:
when gf clicked // you can also use a broadcast forever if <touching (mouse-pointer v)?> then change size by (((size)-(125)) / (6) else change size by (((size)-(100)) / (6) end end
This uses size blocks to slowly make the sprite bigger when your mouse-pointer is over it, and smaller when it's not.
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. It is recommended to not store personal information in the OS and to have a default password/passcode.|
|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 chat bots. Being unique in their applications will help make their OS stick out. A good suggestion would be to add mini games, sounds, and more.
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.|
Official 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 are more complicated and involve many different parts, such as the boot loader 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.