How can I load images by specifying a path through the "image" folder in JSON?

Not favoritedFavorited Favorited 0 favourites
  • 2 posts
From the Asset Store
A template for creating sprite editing functionality, including selection, resizing, rotation, duplication and more
  • Hello everyone! I have a question that's been bothering me: How can I specify a path to a texture in the "image" folder via JSON?

    I'm planning to allow players to add their own custom content to the game using JSON. Here's an example of my JSON structure:

    {

    "mods": [ { "id": 1, "name": "Firearms+", "description": "This mod adds new guns", "weapons": [ { "id": 101, "name": "Flamethrower", "textures": { "inventory": "(path to the image folder and PNG texture)", "bullet": "(path to the image folder and PNG texture)" }, "stats": { "damage": 300, "speed": 200 } } ]

    }

    ]

    }

    I need to know:

    1. What is the correct way to specify the path to an image stored in the "image" folder?

    2. How should I load these textures in Construct 3 using this JSON data?

    Any help or examples would be greatly appreciated! Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1. What is the correct way to specify the path to an image stored in the "image" folder?

    Try "Image/filename.png" or "/Image/filename.png"

    2. How should I load these textures in Construct 3 using this JSON data?

    Sprite Load from URL action.

    URL: JSON.get("mods.0.weapons.0.textures.inventory")

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