Browse Source

json

master
parent
commit
0a88a267fe
7 changed files with 94 additions and 0 deletions
  1. +1
    -0
      json/001.мир.js
  2. +30
    -0
      json/011.настройки.js
  3. +29
    -0
      json/101.ресурсы.js
  4. +1
    -0
      json/999.игра.js
  5. +33
    -0
      json/index.html
  6. BIN
      json/loop.wav
  7. BIN
      json/основа.jpg

+ 1
- 0
json/001.мир.js View File

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

+ 30
- 0
json/011.настройки.js 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() { },
},
};

+ 29
- 0
json/101.ресурсы.js 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
- 0
json/999.игра.js View File

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

+ 33
- 0
json/index.html 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 View File


BIN
json/основа.jpg View File

Before After
Width: 8  |  Height: 8  |  Size: 1.2KB

Loading…
Cancel
Save