Jump to content

How to detect and load multiple json files in a directory at once


OJs
 Share

Recommended Posts

I am a new bee in Pixi tilemap, I used below code to load each of the individual json files based on their level.

this.app.loader
      .add('map0', '/assets/level_0/level_0.json')
      .add('map1', '/assets/level_1/level_1.json')
      .add('map2', '/assets/level_2/level_2.json')

 I kindly ask for insights on the better way to do this so that I can detect and load all JSON files present in the folder at once without specifying them individually

I will appreciate your response

Regards

Edited by OJs
Correction
Link to comment
Share on other sites

 I can detect and load all JSON files present in the folder at once without specifying them individually
 

Welcome to the web development, its not possible to list files in directories there :( Maybe with webpack and rollup and whatever you write to assemble application you can just generate this , but honestly, better to write it by hand.

For more details, ask in our discord.

Edited by ivan.popelyshev
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...