make node-webkit .exe load images from a folder?

Get help using Construct 2

Post » Sun Jul 14, 2013 9:55 pm

Hi everyone,

My client is hoping for a PC .exe game that loads images from a folder in the same folder as the game .exe file, so that they can swap out images in the folder and have them appear in the game. This possible?

I searched and found stuff about loading external images, but when I export via node-webkit the images it loads are hidden or built into the .exe or something.

Anyone know how to make this happen?

thanks,
Mike
B
47
S
9
G
4
Posts: 421
Reputation: 6,959

Post » Mon Jul 15, 2013 9:32 am

bump...

no-one?
B
47
S
9
G
4
Posts: 421
Reputation: 6,959

Post » Mon Jul 15, 2013 10:25 am

I have not worked with webkit before so i have no clue :-)

But @Ashley responded to a post last month about external .xml file. I would think that would count as the same.

He stated that it was not possible yet.

See the thread here.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Mon Jul 15, 2013 10:39 am

node-webkit plugin is capable to read files from external.

I tried to load image to sprite from path, it doesn't work... but the text works. I don't know why. I'm looking a solution.

B
91
S
31
G
29
Posts: 3,129
Reputation: 27,789

Post » Mon Jul 15, 2013 10:41 am

thanks for the heads up cvp, Actually I figured out what I needed.

step 1) in the projects window, right click the files folder and choose import, then import the images you want to load from a folder.
step 2) Add events at the start of your game to load from URL into your sprites, but instead of URL's, just add the images names such as "imageOne.png"
step 3) Export the game as node-web-kit
step 4) Go into the win32 folder that node-webkit created and find the file called package.nw and rename it to add .zip to the end of it. (becuase its really a .zip file)
step 5) open the zip file you just created by rename it to .zip and replace the images you had "imported" with new images.
step 6) rename the file again to get rid of .zip.

The next time the game is run it will display the new images.

cheers,
Mike
B
47
S
9
G
4
Posts: 421
Reputation: 6,959

Post » Mon Jul 15, 2013 11:28 am

@Brashmonkey Also Load image from URL -> NodeWebkit.AppFolder&"images/image.png" works but only on exportet exe. On next version of Construct you can preview as node-webkit so maybe it works then.

Edit: To be clear just create folder whit images to the application folder (win32).Katala2013-07-15 11:50:27
B
33
S
9
G
3
Posts: 517
Reputation: 5,181

Post » Mon Jul 15, 2013 8:05 pm

Very cool! Thanks for making my life easier Katala (And Scirra, as always). Can't express how much I love using C2.

Mike
B
47
S
9
G
4
Posts: 421
Reputation: 6,959


Return to How do I....?

Who is online

Users browsing this forum: kabaal, oddreal, raulcg1981, SondeepH and 11 guests