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

Get help using Construct 2

Post » Fri Feb 12, 2016 5:38 pm

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
B
26
S
9
G
2
Posts: 234
Reputation: 3,199

Post » Fri Feb 12, 2016 5:45 pm

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
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Fri Feb 12, 2016 5:50 pm

@mindfaQ I guess I'll go the basic animation way I was trying to avoid then.. Thanks for the help!
B
26
S
9
G
2
Posts: 234
Reputation: 3,199


Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish, marc254, tarek2 and 10 guests