How to Make an Operating System

Материал из Поле цифровой дидактики

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.

Making Sprites

Begin by creating the sprites for the Operating System, as shown below.


  • Loading sprite (optional)
  • Logo (optional)
  • Password Manager (optional)
  • Application (Games, apps, etc.)

One can also add other sprites, like a menu sprite, or a user profile picture sprite.

Effects

Fading in can be used as a transition. This is a way of making a fade in effect using the ghost effect block:

whenclickedsetghosteffectto100repeat25changeghosteffectby-4end

Fading out can also be used as an ending effect. This is a script for a fade-out effect:

whenclickedsetghosteffectto0repeat25changeghosteffectby4end

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:

whenclickedsetxvelocityto5repeat50changexbyxvelocitychangexvelocityby-0.1end

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.

Loading

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:

whenIreceiveloadshowrepeatpickrandom1to20wait0.3secsnextcostumeendhidebroadcastpassword

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.

whenclickedshowwhenIreceivepasswordhide

User Management

One can add a password to an OS. To make one, create a variable called password. Then, place these scripts:

whenclickedsetpasswordtoinsertanytext

After setting the password, place these scripts:

whenIreceivepasswordaskPasswordpleaseandwaitifanswer=passwordthenIfthepasswordiscorrect,itloadssayLoading…forpickrandom1to8secsbroadcastOSCompleteelsesaySorry,pleasetryagain.for2secsbroadcastpasswordthiswillre-runthisscript
whenIreceiveOSComplete...thesescriptswillrunifthepasswordiscorrect

Or, this workaround can be used:

repeatuntilanswer=passwordaskPasswordpleaseandwaitendsayLoading...forpickrandom1to8secsbroadcastOSComplete

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.


Applications

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 whenclicked with whenIreceivemessage1. This can reduce lag. Make sure that the script

whenclickedbroadcastmessage1

is somewhere in your project.

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. But don't get your hopes down! Scratch OSes can actually be really complex and detailed with enough work.

See Also