Skip to content

Commit

Permalink
added example for loading assets via json
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Westover <[email protected]>
  • Loading branch information
scottwestover committed Jul 3, 2024
1 parent a158650 commit b567882
Show file tree
Hide file tree
Showing 16 changed files with 6,481 additions and 0 deletions.
Binary file not shown.
83 changes: 83 additions & 0 deletions examples/loading-assets-with-json-pack/assets/data/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[
{
"path": "assets/images/axulart/character",
"files": [
{
"type": "spritesheet",
"key": "player",
"url": "custom.png",
"frameConfig": { "frameWidth": 64, "frameHeight": 88 }
}
]
},
{
"path": "assets/images/monster-tamer/battle-backgrounds",
"files": [
{
"type": "image",
"key": "forest",
"url": "forest-background.png"
}
]
},
{
"path": "assets/images/monster-tamer/monsters",
"files": [
{
"type": "image",
"key": "carnodusk",
"url": "carnodusk.png"
},
{
"type": "image",
"key": "iguanignite",
"url": "iguanignite.png"
},
{
"type": "image",
"key": "aquavalor",
"url": "aquavalor.png"
},
{
"type": "image",
"key": "frostsaber",
"url": "frostsaber.png"
},
{
"type": "image",
"key": "ignivolt",
"url": "ignivolt.png"
},
{
"type": "image",
"key": "parazoid",
"url": "parazoid.png"
},
{
"type": "image",
"key": "jivy",
"url": "jivy.png"
}
]
},
{
"path": "assets/data",
"files": [
{
"type": "json",
"key": "item_data",
"url": "items.json"
}
]
},
{
"path": "assets/audio/xDeviruchi",
"files": [
{
"type": "audio",
"key": "title_theme",
"url": "Title-Theme.wav"
}
]
}
]
9 changes: 9 additions & 0 deletions examples/loading-assets-with-json-pack/assets/data/items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"id": 1,
"name": "potion",
"description": "A basic healing item that will heal 30 HP from a single monster.",
"category": "HEAL",
"effect": "HEAL_30"
}
]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Small 8-direction Characters:
Last update: September 15, 2021

By: AlexDreamer
https://axulart.itch.io/small-8-direction-characters
https://axulart.tumblr.com/

Includes:
8-direction characters sprites (Girl, Boy and Template)

LICENCE: This asset pack can be used in both free and commercial projects. You can modify it to suit your own needs, as long as you give appropriate credit. You may not redistribute it or resell it.

Creative Commons License:
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Thank you for download this game-asset & God Bless you :D
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,345 changes: 6,345 additions & 0 deletions examples/loading-assets-with-json-pack/assets/js/index-BNWnxF-c.js

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions examples/loading-assets-with-json-pack/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Phaser 3 Example - Loading Assets Via JSON</title>
<style>
html,
body,
.container {
margin: 0px;
height: 100vh;
width: 100vw;
overflow: hidden;
background: #d7d7d7;
display: flex;
flex-direction: column;
align-items: center;
}
</style>
<script type="module" crossorigin src="./assets/js/index-BNWnxF-c.js"></script>
</head>
<body>
<div class="container" id="game-container">
<h1>Phaser 3 Example: Loading Assets via Pack JSON</h1>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ <h2>Examples</h2>
<li><a href="examples/scene-transition-geometry-mask/index.html" target="_blank">Scene Transition With Geometry Mask Example</a></li>
<li><a href="examples/arcade-physics-conveyor-belt/index.html" target="_blank">Arcade Physics Conveyor Belt</a></li>
<li><a href="examples/loader-plugin/index.html" target="_blank">Loader Plugin Example</a></li>
<li><a href="examples/loading-assets-with-json-pack/index.html" target="_blank">Loading Assets With JSON Pack</a></li>
</ul>

<h2>Games</h2>
Expand Down

0 comments on commit b567882

Please sign in to comment.