0 Favourites

How do I load a sprite each time from a different folder?

  • Hey. I've been working on a project earlier and I've two folders of the same sprites but with different colors...

    I'm trying to do it so if var = 0, it loads the sprite from "right" folder.

    If var = 1, it loads the same sprite from "left" folder.

    I've tried using folders in project files but after exporting, all the sprites are added together in the root game folder...

    So I tried loading a sprite from "\right\image.png" and after exporting, I add the "right" folder to the game's folder, didn't seem to work for me..

    Am I doing something wrong or there's another solution to choose one of two sprites for every object on the layout on start of that layout....

    Thanks

  • Indeed project files organization into folder is not present after export, and you can't even add files of the same name more than once, no matter where you put them in the project files folder structure.

    Workarounds I know of are:

    • load the images into sprites and make the differentiation through the animation names
    • only works with export to NW.js, add the nwjs object -> load from nwjs.appfolder&"/left/1.png" (for test purposes you can change the nwjs.appfolder to a local folder, where it finds your subdirectories) -> then after export you can add those directories to your game directory and access should work within the appfolder
  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • mindfaQ I guess I'll go the basic animation way I was trying to avoid then.. Thanks for the help!

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