This commit is contained in:
2021-05-22 13:14:09 +03:00
parent c495326dff
commit 0a88a267fe
7 changed files with 94 additions and 0 deletions

1
json/001.мир.js Normal file
View File

@@ -0,0 +1 @@
var мир = {};

View File

@@ -0,0 +1,30 @@
мир.настройки = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: 0xfbfbfb,
scale: {
width: 800,
height: 600,
parent: document.getElementById("родитель"),
mode: Phaser.Scale.ENVELOP,
autoCenter: Phaser.Scale.CENTER_BOTH,
},
physics: {
default: "matter",
matter: {
gravity: {
y: 0.01,
},
debug: {
showBody: true,
showStaticBody: true,
},
},
},
scene: {
preload: function() { },
create: function() { },
update: function() { },
},
};

View File

@@ -0,0 +1,29 @@
мир.ресурсы = {
изображения: {
основа: "основа.jpg",
},
звуки: {
цикл: "loop.wav",
},
};
мир.настройки.scene.preload = function()
{
const изо = мир.ресурсы.изображения;
if (изо)
{
for (имя in изо)
{
this.load.image(имя, изо[имя]);
}
}
const звуки = мир.ресурсы.звуки;
if (звуки)
{
for (имя in звуки)
{
this.load.audio(имя, звуки[имя]);
}
}
};

1
json/999.игра.js Normal file
View File

@@ -0,0 +1 @@
мир.игра = new Phaser.Game(мир.настройки);

33
json/index.html Normal file
View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>J 0.1.0</title>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.54.0/dist/phaser.min.js"></script>
<style>
html, body {
margin: 0;
padding: 0;
overflow: hidden;
}
body {
height: 100vh;
width: 100vw;
}
#родитель
{
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="родитель"></div>
<script src="001.мир.js"></script>
<script src="011.настройки.js"></script>
<script src="101.ресурсы.js"></script>
<script src="999.игра.js"></script>
</body>
</html>

BIN
json/loop.wav Normal file

Binary file not shown.

BIN
json/основа.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB