Sound On/Off Button

Материал из Поле цифровой дидактики
Версия от 02:44, 2 мая 2022; scratch>CrazyBoy826 (clarify)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)

Шаблон:Expand Шаблон:Warning

A sound on/off button may be useful when making a game that has music or sound that can be muted or stopped.

To make a sound on/off button, one will need a sprite in the form of a switch. The switch must provide two costumes, one to represent when sound is on, and the other to represent when sound is off.

when gf clicked
switch costume to (sound-on v)

when this sprite clicked
next costume
if <(costume [number v]) = [2]> then //assuming the second costume is "off" and the first "on"
set volume to (0)% //if now off, turn off the volume
else
set volume to (100)% //if now on, turn on the volume
end

This script can be modified to allow the Шаблон:Val to be changed.

Шаблон:Note

See Also

References

<references/>