From 2991d14aaa893e4ff98c592abd693c84549e07e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Wed, 14 Apr 2021 14:31:43 +0300 Subject: [PATCH] =?UTF-8?q?=D1=86=D0=B5=D0=BD=D1=82=D1=80=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BE=D0=B1=D0=BB=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BE=D1=82=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 ++-- игра/011.phaser.js | 30 ++++++++++++++++++++++++++++++ игра/101.сцена.js | 2 +- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 5beaa3e..05910b5 100644 --- a/index.html +++ b/index.html @@ -4,11 +4,11 @@ КОЛОБОК + + - - diff --git a/игра/011.phaser.js b/игра/011.phaser.js index 41316a8..86aff12 100644 --- a/игра/011.phaser.js +++ b/игра/011.phaser.js @@ -5,12 +5,37 @@ * */ + +ПодготовитьОбластьОтрисовки = мир => +{ + var родитель = document.createElement("div"); + родитель.style = ` +position: absolute; +left: 0; +right: 0; +bottom: 0; +top: 0; +display: flex; +align-items: center; + `; + var ребёнок = document.createElement("div"); + ребёнок.style = `margin: auto;`; + родитель.appendChild(ребёнок); + document.body.appendChild(родитель); + + мир.областьОтрисовки = ребёнок; +}; + + +// // // // + НастроитьИгру = мир => { мир.настройки = { type: Phaser.AUTO, width: 800, height: 600, + parent: мир.областьОтрисовки, physics: { default: "arcade", arcade: { @@ -37,21 +62,26 @@ }; }; + // // // // + ЗапуститьИгру = мир => { мир.игра = new Phaser.Game(мир.настройки); }; + /* * * Последовательность * */ + мир.разобрать(` пуск + подготовить область отрисовки настроить игру запустить игру `); diff --git a/игра/101.сцена.js b/игра/101.сцена.js index 7e1d821..38a0fce 100644 --- a/игра/101.сцена.js +++ b/игра/101.сцена.js @@ -13,7 +13,7 @@ ДобавитьФонИзбы = мир => { - мир.сцена.add.image(200, 200, "изба"); + мир.сцена.add.image(0, 0, "изба").setOrigin(0, 0); }; /*