Similar to Playground Fields, which are great for tweaking gameplay-related elements, choosing the first level and so on, Luna Playground supports configurable assets that it can replace within your playable, opening a whole new set of customisation abilities.
1. Open playground.json configuration file and locate
Each asset is defined as a simple JSON object residing under specific
asset key. Let's take this by example: consider the below
The asset key (
my-sprite-001 in the above example) can be chosen arbitrary - just like with Playground Fields and their class/field names, this will be used by Playground during playable updates to keep the mapping between previously stored settings and a new playable.
The important keys in the asset JSON are:
id- please set to some unique value for each asset, will be used down the road
type- please choose between
audioclipto hint Playground on which file types to allow for upload.
To do so, please locale (or create new)
<audio /> or
<video /> tag in your playable HTML file and make sure it meets the following requirements:
srcattribute is set to some Data URI value, can be faux, i.e.
<img src="data:image/png;base64," />
idattribute is set to
"asset/ID", where ID stands for the id value you chose for each asset on step #2.
For the asset defined in the example on step #2, the following bit of HTML is expected to be present somewhere in the Playable:
This is it! Uploading such a playable to Playground will expose asset fields in the editor section, allowing you to replace images, audio clips and video clips within your playable.
Feel free to check the example residing at https://github.com/LunaCommunity/Playable-Examples/tree/master/assets for a minimal setup of a playable using Playground Assets.