0 Favourites

How do I load images from relative links

  • Hey, I'm working on a project in which i need to load images from relative link. The problem is i'm not sure how to call a proper path. Let's say I got it on "www.gamedomain.com". I did links to external files (images loaded into a sprite):

    { Load image from "www.gamedomain.com/data/minigame1/image.jpg". }

    Asuming that the main file is executioned from "www.gamedomain.com" i tried put path links like

    { Load image from "/data/minigame1/"&loadedImage } (loadedImage a variable that holds file name).

    Unfortunately it didn't work. Any idea how to make it possible? I asume that if it will work I could load files the same way from local drive from relative to the game file path - is it right?

    Any help would be appreciated. Thanks in advance

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Did you try without the first forward slash?

    (i.e. "data/minigame1..." instead of "/data/minigame1...")

  • Hey, it worked now as you wrote "Hundredfold".

    I tired it befeore but didn't see it working on local host that's why i thought it was wrong. To makt it work locally i had to export project to html, lunch and preview on firefox.

  • I see this is very old so not sure it's being monitored. I also need to do the same thing. If you set it to use a relative link is it possible to continue to develop and test the game without compiling it with the images coming from another folder?

    This is my explanation of what I want to do, it sounds similar

    Odd how the / is missed off, I would have expected as in HTML to start the link with a /

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