Loading tilemaps from project files using JSON and AJAX?

0 favourites
  • 4 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I'm trying to load a tilemap that I previously downloaded using the JSON download action. I placed this file in my project files and told the AJAX plugin to load it, and when it finished I told the tilemap object to load this tilemap. In the debug the JSON is loaded by the AJAX plugin but the tilemap doesn't change. Can anyone help me?

  • You need to pay attention to the expression and action you are using when dealing with tiles JSON. Objects have a common expression "AsJSON" that saves their entire state in a JSON string, and a common action "Set from JSON" to load their state from such a string. However, the tilemap have specific expression / action to save / load only its tile data, namely "TilesJSON" and "Load". You should be using "TileJSON" with "Load", or "AsJSON" with "Set from JSON", not a mix of both set.

    Or maybe your problem is something else entirely, but we lack information to really help you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to pay attention to the expression and action you are using when dealing with tiles JSON. Objects have a common expression "AsJSON" that saves their entire state in a JSON string, and a common action "Set from JSON" to load their state from such a string. However, the tilemap have specific expression / action to save / load only its tile data, namely "TilesJSON" and "Load". You should be using "TileJSON" with "Load", or "AsJSON" with "Set from JSON", not a mix of both set.

    Or maybe your problem is something else entirely, but we lack information to really help you.

    I double checked that but i was using tile data download and upload for both situations. I think the problem might have to do with how I am referencing it. Right now I'm using AJAX.LastData to reference the string. Is that correct or should I reference it differently?

  • AJAX.LastData inside the "on completed" trigger is the way to go.

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