diff --git a/001.мир.js b/001.мир.js deleted file mode 100644 index 8711b98..0000000 --- a/001.мир.js +++ /dev/null @@ -1,190 +0,0 @@ -/* - * - * Реализация шаблона "издатель-подписчик" - * - */ - -function Уведомитель() -{ - function Подписка(id, отклик, уведомитель) - { - this.id = id; - this.отклик = отклик; - this.уведомитель = уведомитель; - }; - - this.уведомить = function() - { - // Попутно собираем подписки без отклика. - var безотклика = []; - for (var номер in this.подписки) - { - var подписка = this.подписки[номер]; - if (подписка.отклик) - { - подписка.отклик(); - } - else - { - безотклика.push(подписка); - } - } - - // И удаляем их. - if (безотклика.length) - { - this._удалитьПодпискиБезОтклика(безотклика); - } - }; - - this.подписать = function(отклик) - { - var id = this._сгенерироватьUUID(); - var подписка = new Подписка(id, отклик, this); - this.подписки.push(подписка); - return подписка; - }; - - this.отписать = function(подписка) - { - подписка.отклик = null; - }; - - this._удалитьПодпискиБезОтклика = function(удалить) - { - var подписка = удалить.shift() - while (подписка) - { - var индекс = this.подписки.indexOf(подписка); - if (индекс !== -1) - { - this.подписки.splice(индекс, 1); - } - var подписка = удалить.shift() - } - }; - - this._сгенерироватьUUID = function() - { - // https://stackoverflow.com/a/2117523 - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace( - /[xy]/g, - function(c) - { - var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); - return v.toString(16); - } - ); - }; - - // Конструктор. - this.подписки = []; -} - -/* - * - * Связь событий и реакций в виде последовательности (череды) - * - */ - -function Мир() -{ - // Разобрать события и реакции, выраженные в тексте. - this.разобрать = function(череда) - { - var соответствия = this._событияРеакции(череда); - for (var событие in соответствия) - { - if (!(событие in this.события)) - { - this.события[событие] = new Уведомитель(); - } - var реакции = соответствия[событие]; - for (var номер in реакции) - { - const реакция = реакции[номер]; - const название = this._имяФункцииИзРеакции(реакция); - const функция = eval(название); - var тут = this; - this.события[событие].подписать(function(){ - функция(тут); - }); - } - } - }; - - // Уведомить о событии при его наличии. - this.уведомить = function(событие) - { - if (событие in this.события) - { - this.события[событие].уведомить(); - } - }; - - // Разобрать текст с событиями и реакциями, вернуть словарь их соответствия. - this._событияРеакции = function(текст) - { - var соответствие = {}; - - var элементы = текст.split("\n"); - var имяСобытия = null; - for (var номер in элементы) - { - var элемент = элементы[номер]; - // Пропускаем комментарии. - if (элемент.charAt(0) == "#") - { - continue; - } - var имя = элемент.trim(); - // Пропускаем пустые строки. - if (!имя.length) - { - continue; - } - // Событие. - if (имя == элемент) - { - if (!(имя in соответствие)) - { - имяСобытия = имя; - соответствие[имя] = []; - } - } - // Реакция. - else - { - соответствие[имяСобытия].push(имя); - } - } - - return соответствие; - }; - - // Преобразовать имя реакции в название функции. - this._имяФункцииИзРеакции = function(реакция) - { - var имя = ""; - - var части = реакция.split(" "); - for (var номер in части) - { - var часть = части[номер]; - имя += часть.charAt(0).toUpperCase() + часть.slice(1); - } - - return имя; - }; - - // Конструктор. - this.события = {}; -} - -/* - * - * Создание глобального мира. - * - */ - -мир = new Мир(); diff --git a/json/011.настройки.js b/011.настройки.js similarity index 100% rename from json/011.настройки.js rename to 011.настройки.js diff --git a/json/101.ресурсы.js b/101.ресурсы.js similarity index 81% rename from json/101.ресурсы.js rename to 101.ресурсы.js index af6db63..1b36c9b 100644 --- a/json/101.ресурсы.js +++ b/101.ресурсы.js @@ -1,9 +1,9 @@ мир.ресурсы = { изображения: { - основа: "основа.jpg", + основа: "р/отладка/основа.jpg", }, звуки: { - цикл: "loop.wav", + цикл: "р/звуки/555803__ddmyzik__sunset-loop.wav", }, }; diff --git a/499.пуск.js b/499.пуск.js deleted file mode 100644 index df758ae..0000000 --- a/499.пуск.js +++ /dev/null @@ -1 +0,0 @@ -мир.уведомить("пуск"); diff --git a/json/999.игра.js b/999.игра.js similarity index 100% rename from json/999.игра.js rename to 999.игра.js diff --git a/index.html b/index.html index 53fce00..89a8cd2 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - J 0.1.0 + K 0.9.0 - - -
- - - - - - diff --git a/основа.jpg b/основа.jpg deleted file mode 100644 index 5c95781..0000000 Binary files a/основа.jpg and /dev/null differ diff --git a/р/вещи/банка_молока.png b/р/вещи/банка_молока.png new file mode 100644 index 0000000..237692b Binary files /dev/null and b/р/вещи/банка_молока.png differ diff --git a/р/вещи/банка_молока.xcf b/р/вещи/банка_молока.xcf new file mode 100644 index 0000000..46ccf73 Binary files /dev/null and b/р/вещи/банка_молока.xcf differ diff --git a/р/вещи/крышка-подпола.png b/р/вещи/крышка-подпола.png new file mode 100644 index 0000000..e13e6a2 Binary files /dev/null and b/р/вещи/крышка-подпола.png differ diff --git a/р/вещи/крышка-подпола.xcf b/р/вещи/крышка-подпола.xcf new file mode 100644 index 0000000..0772e3a Binary files /dev/null and b/р/вещи/крышка-подпола.xcf differ diff --git a/р/вещи/лестница.png b/р/вещи/лестница.png new file mode 100644 index 0000000..cc4a102 Binary files /dev/null and b/р/вещи/лестница.png differ diff --git a/р/вещи/лестница.xcf b/р/вещи/лестница.xcf new file mode 100644 index 0000000..70a4fdb Binary files /dev/null and b/р/вещи/лестница.xcf differ diff --git a/р/вещи/лужа.png b/р/вещи/лужа.png new file mode 100644 index 0000000..45da705 Binary files /dev/null and b/р/вещи/лужа.png differ diff --git a/р/вещи/лужа.xcf b/р/вещи/лужа.xcf new file mode 100644 index 0000000..56547a9 Binary files /dev/null and b/р/вещи/лужа.xcf differ diff --git a/р/вещи/окно.xcf b/р/вещи/окно.xcf new file mode 100644 index 0000000..eee0064 Binary files /dev/null and b/р/вещи/окно.xcf differ diff --git a/р/вещи/окно_дыра.png b/р/вещи/окно_дыра.png new file mode 100644 index 0000000..acb6b6c Binary files /dev/null and b/р/вещи/окно_дыра.png differ diff --git a/р/вещи/окно_разбитая-часть.png b/р/вещи/окно_разбитая-часть.png new file mode 100644 index 0000000..fcde3d4 Binary files /dev/null and b/р/вещи/окно_разбитая-часть.png differ diff --git a/р/вещи/самовар.png b/р/вещи/самовар.png new file mode 100644 index 0000000..df8fa77 Binary files /dev/null and b/р/вещи/самовар.png differ diff --git a/р/вещи/самовар.xcf b/р/вещи/самовар.xcf new file mode 100644 index 0000000..5e49183 Binary files /dev/null and b/р/вещи/самовар.xcf differ diff --git a/р/вещи/стрела.png b/р/вещи/стрела.png new file mode 100644 index 0000000..cc27680 Binary files /dev/null and b/р/вещи/стрела.png differ diff --git a/р/вещи/стрела.xcf b/р/вещи/стрела.xcf new file mode 100644 index 0000000..28dbcd6 Binary files /dev/null and b/р/вещи/стрела.xcf differ diff --git a/р/животные/мышь.png b/р/животные/мышь.png new file mode 100644 index 0000000..58036c9 Binary files /dev/null and b/р/животные/мышь.png differ diff --git a/р/животные/мышь.xcf b/р/животные/мышь.xcf new file mode 100644 index 0000000..d1fe06e Binary files /dev/null and b/р/животные/мышь.xcf differ diff --git a/р/животные/паук.png b/р/животные/паук.png new file mode 100644 index 0000000..87b3431 Binary files /dev/null and b/р/животные/паук.png differ diff --git a/р/животные/паук.xcf b/р/животные/паук.xcf new file mode 100644 index 0000000..e110b38 Binary files /dev/null and b/р/животные/паук.xcf differ diff --git a/р/звуки/235596__tcrocker68__large-glassbottle-fall-woodfloor.wav b/р/звуки/235596__tcrocker68__large-glassbottle-fall-woodfloor.wav new file mode 100644 index 0000000..81cf24d Binary files /dev/null and b/р/звуки/235596__tcrocker68__large-glassbottle-fall-woodfloor.wav differ diff --git a/р/звуки/330800__czarcazas__shattering-glass-small.mp3 b/р/звуки/330800__czarcazas__shattering-glass-small.mp3 new file mode 100644 index 0000000..710ca1a Binary files /dev/null and b/р/звуки/330800__czarcazas__shattering-glass-small.mp3 differ diff --git a/р/звуки/331381__qubodup__public-domain-jump-sound.wav b/р/звуки/331381__qubodup__public-domain-jump-sound.wav new file mode 100644 index 0000000..c5cd8e9 Binary files /dev/null and b/р/звуки/331381__qubodup__public-domain-jump-sound.wav differ diff --git a/р/звуки/352065__cabled-mess__glassy-bits-06.wav b/р/звуки/352065__cabled-mess__glassy-bits-06.wav new file mode 100644 index 0000000..c4d7bb5 Binary files /dev/null and b/р/звуки/352065__cabled-mess__glassy-bits-06.wav differ diff --git a/р/звуки/360432__davethetech__clink-bottle3.wav b/р/звуки/360432__davethetech__clink-bottle3.wav new file mode 100644 index 0000000..9f77cb2 Binary files /dev/null and b/р/звуки/360432__davethetech__clink-bottle3.wav differ diff --git a/р/звуки/387922__setuniman__scheming-1o95.mp3 b/р/звуки/387922__setuniman__scheming-1o95.mp3 new file mode 100644 index 0000000..f378cca Binary files /dev/null and b/р/звуки/387922__setuniman__scheming-1o95.mp3 differ diff --git a/р/звуки/437650__dersuperanton__getting-hit-damage-scream.wav b/р/звуки/437650__dersuperanton__getting-hit-damage-scream.wav new file mode 100644 index 0000000..b26ea35 Binary files /dev/null and b/р/звуки/437650__dersuperanton__getting-hit-damage-scream.wav differ diff --git a/р/звуки/448004__kneeling__break-window.mp3 b/р/звуки/448004__kneeling__break-window.mp3 new file mode 100644 index 0000000..cef8650 Binary files /dev/null and b/р/звуки/448004__kneeling__break-window.mp3 differ diff --git a/р/звуки/521552__omerbhatti34__arrow-impact.mp3 b/р/звуки/521552__omerbhatti34__arrow-impact.mp3 new file mode 100644 index 0000000..18b1c6a Binary files /dev/null and b/р/звуки/521552__omerbhatti34__arrow-impact.mp3 differ diff --git a/р/звуки/543927__eminyildirim__pistol-gun-cocking.wav b/р/звуки/543927__eminyildirim__pistol-gun-cocking.wav new file mode 100644 index 0000000..e6533d7 Binary files /dev/null and b/р/звуки/543927__eminyildirim__pistol-gun-cocking.wav differ diff --git a/json/loop.wav b/р/звуки/555803__ddmyzik__sunset-loop.wav similarity index 100% rename from json/loop.wav rename to р/звуки/555803__ddmyzik__sunset-loop.wav diff --git a/р/звуки/README.md b/р/звуки/README.md new file mode 100644 index 0000000..35e32e1 --- /dev/null +++ b/р/звуки/README.md @@ -0,0 +1,10 @@ +* https://freesound.org/people/DDmyzik/sounds/555803/ +* https://freesound.org/people/Setuniman/sounds/387922/ +* https://freesound.org/people/qubodup/sounds/331381/ +* https://freesound.org/people/davethetech/sounds/360432/ +* https://freesound.org/people/omerbhatti34/sounds/521552/ + * https://freesound.org/people/Czarcazas/sounds/330800/ +* https://freesound.org/people/Kneeling/sounds/448004/ +* https://freesound.org/people/EminYILDIRIM/sounds/543927/ +* https://freesound.org/people/tcrocker68/sounds/235596/ +* https://freesound.org/people/cabled_mess/sounds/352065/ diff --git a/р/колобок/анимации/колобок-анимации.autosave.scml b/р/колобок/анимации/колобок-анимации.autosave.scml new file mode 100644 index 0000000..547e7c4 --- /dev/null +++ b/р/колобок/анимации/колобок-анимации.autosave.scml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/р/колобок/анимации/колобок-анимации.scml b/р/колобок/анимации/колобок-анимации.scml new file mode 100644 index 0000000..547e7c4 --- /dev/null +++ b/р/колобок/анимации/колобок-анимации.scml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/р/колобок/анимации/колобок_вращение.png b/р/колобок/анимации/колобок_вращение.png new file mode 100644 index 0000000..363902a Binary files /dev/null and b/р/колобок/анимации/колобок_вращение.png differ diff --git a/р/колобок/анимации/колобок_прыжок.png b/р/колобок/анимации/колобок_прыжок.png new file mode 100644 index 0000000..4773027 Binary files /dev/null and b/р/колобок/анимации/колобок_прыжок.png differ diff --git a/р/колобок/колобок.png b/р/колобок/колобок.png new file mode 100644 index 0000000..7091537 Binary files /dev/null and b/р/колобок/колобок.png differ diff --git a/р/колобок/колобок_все.xcf b/р/колобок/колобок_все.xcf new file mode 100644 index 0000000..81c6aaa Binary files /dev/null and b/р/колобок/колобок_все.xcf differ diff --git a/р/колобок/колобок_неподвижен.png b/р/колобок/колобок_неподвижен.png new file mode 100644 index 0000000..41af670 Binary files /dev/null and b/р/колобок/колобок_неподвижен.png differ diff --git a/р/колобок/колобок_неподвижен.xcf b/р/колобок/колобок_неподвижен.xcf new file mode 100644 index 0000000..1ff5a82 Binary files /dev/null and b/р/колобок/колобок_неподвижен.xcf differ diff --git a/р/колобок/колобок_прыжок.xcf b/р/колобок/колобок_прыжок.xcf new file mode 100644 index 0000000..62d233e Binary files /dev/null and b/р/колобок/колобок_прыжок.xcf differ diff --git a/р/отладка/линия_вертикальная.png b/р/отладка/линия_вертикальная.png new file mode 100644 index 0000000..5881a7d Binary files /dev/null and b/р/отладка/линия_вертикальная.png differ diff --git a/р/отладка/линия_вертикальная.xcf b/р/отладка/линия_вертикальная.xcf new file mode 100644 index 0000000..17a805b Binary files /dev/null and b/р/отладка/линия_вертикальная.xcf differ diff --git a/json/основа.jpg b/р/отладка/основа.jpg similarity index 100% rename from json/основа.jpg rename to р/отладка/основа.jpg diff --git a/р/отладка/основа.xcf b/р/отладка/основа.xcf new file mode 100644 index 0000000..6240a8e Binary files /dev/null and b/р/отладка/основа.xcf differ diff --git a/р/сцены/изба.jpg b/р/сцены/изба.jpg new file mode 100644 index 0000000..0a5ec04 Binary files /dev/null and b/р/сцены/изба.jpg differ diff --git a/р/сцены/изба.xcf b/р/сцены/изба.xcf new file mode 100644 index 0000000..c51c8c7 Binary files /dev/null and b/р/сцены/изба.xcf differ diff --git a/р/сцены/подпол.jpg b/р/сцены/подпол.jpg new file mode 100644 index 0000000..738c88f Binary files /dev/null and b/р/сцены/подпол.jpg differ diff --git a/р/сцены/подпол.xcf b/р/сцены/подпол.xcf new file mode 100644 index 0000000..aa85902 Binary files /dev/null and b/р/сцены/подпол.xcf differ