Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Background images troubles (Sugarcube)

so i've managed to insert an image into my game using this code
html {
background: [img[/home/steve/Desktop/Reid/zzz.jpg]] fixed;
position: absolute;
background-size: cover;
z-index: 1;
width:100%;
height:100%;
top:0;
left:0;
}

I was wondering though if this means that i would only be able to see the background image when using my computer, and if that was the case, how i could fix that if i send it to other people

any advice?

Comments

  • Because you have used an absolute file path in the image URL then it will only be able to be viewed on your machine, which you needed to do so that you could see the image while using Twine 2's Test and Play options to view your story.

    Based on the URL you used in your example I am going to assume you have created a Reid directory/folder on your desktop to store your image files into, I am also assuming that that is the same directory/folder you plan to save the Story HTML file created via the Publish to File option into.
    If the above assumptions are correct then you can change your image URL to a relative one like so:
    html {
    background: [img[zzz.jpg]] fixed;
    position: absolute;
    background-size: cover;
    z-index: 1;
    width:100%;
    height:100%;
    top:0;
    left:0;
    }
    

    Unfortunately the Test and Play options don't support viewing images via relative URLs but if you use the Publish to File option to create/save your Story HTML into the Reid directory/folder and the image will appear when you view that HTML file within a web-browser.
Sign In or Register to comment.