How to Make an Operating System

Материал из Поле цифровой дидактики
Версия от 14:21, 12 августа 2022; Patarakin (обсуждение | вклад) (→‎Applications)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)

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:

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 [5]
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.

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:

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

User Management

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.


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 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.

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