Got pictures to display..yay! But only display when I click the html..running the game won't display

Hi everyone, forgive a noob question. I had a terrible time getting images to show until a nice person told me I needed to enable third-party cookies. Ok so got game folders with images inside and it finally worked. However, I’m confused. When I run the game, the text shows but not the image. However, when I go into the folder and click the HTML file, the picture displays fine. Is this normal…lol. I’m such a noob, but I thank you for your time and help. Shouldn’t the picture show when you run the game though? So is that how you have to test the game, click the HTML inside the folder. I don’t want to leave out any info you guys may need. I created a folder called teststory. Inside I placed another folder called images. Then placed my picture inside of that and did the html image thing. If I left out anything I apologize, I’m really new. Thank you for you help and patience…lol.

The issue is that, when you play the game from within Twine, it doesn’t treat the game like it’s run from whatever directory you’re saving it to, it runs it from somewhere else. This means that your code won’t normally be able to find the images when run from within Twine, because the path to the images is different.

You didn’t say what story format you’re using, but if you’re using the SugarCube story format then you should take a look at “Displaying Images in Twine”. It shows you how to write some “intelligent” code, which can usually automatically tell whether you’re running the game from within Twine or not, and if you are, it makes it so that your code can find the images properly. (FYI - You can click “Jump to Start” in the UI bar at that page to see other Twine/SugarCube sample code.)

You’ll have to edit the links to your images a little bit to get it to work, but after that you should be able to see the images in your game both from within Twine and when you open the HTML file.

Hope that helps! :slight_smile:

1 Like

Thank you so much for you kind reply HIev, I certainly appreciate it.