How to load maps

0 favourites
  • 8 posts
From the Asset Store
A template which allows you to customise the controls of your game.
  • Hello everyone, before the publication of my game I am confronted with a last problem.

    Indeed I have a folder maps, in which is the list of my maps in json, my maps system works well, but how can I make Construct list the name of the map files in a table?

    Thank you for your help

  • I believe you can only do this with NWjs, the app should be exported for desktop. Demo:

    dropbox.com/s/ghrku2llyithi7s/NWJS_ListFiles.capx

    Instead of the folder dialog, you can use app's installation folder, see NWjs expressions.

  • Hello,

    Thank you very much the display of my maps works, but when a player clicks on a map, how can I recover the value, to be able to load the right file?

    Thank you

  • It depends on how you display this file list. I used ListBox, you can access file name using List.SelectedTextAt expression. You might want to use a bunch of text/spritefont objects instead or something similar.

  • Hello,

    Thank you for your help, but I still have a problem, it displays the list of files no matter the extension, how can I display only .json files?

    Thank you

  • You can only add filename to the list if it ends with ".json"

    Use this condition:

    lowercase(right(NWjs.ListAt(loopindex), 5)) = ".json"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh thank you very very much ! :D

    I am trying to make a table but I can not do it, I would like to make a table that gives the information of the maps and a table inside this table which gives the coordinates of the sprites placed on the maps, would you have an idea please?

    Thank you again :)

  • You want to display these tables on the screen? This means that you need to read all files one by one, load them into JSON object, extract the values from them, and only then you will be able to build the table. If a folder contains many files, this can take a lot of time.

    You can put some of the information into the file name. Something like "Map_2000x1000_Forest_355objects.JSON"

    And when user clicks this file, you can read it and display additional information - sprites locations and so on.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)