Changing the background picture

chrisw70
Does anybody know how to change the background picture during the game on an entering room script, or if it can be done? It looks like there's a script for changing the background color, but I would like to change the picture...for example, swapping an image depending whether location is interior/exterior, ect.

jaynabonne
What do you mean by background picture? You can associate a picture with a room to be shown when the room is entered. That isn't so much a background picture, though.

chrisw70
Sorry I mean the one you set at the beginning of making the game with the custom display/interface settings. My room pictures appear in the player's game window with all the text and everything. But when you set up the game it allows you to set a background picture that fills the browser window, instead of just having it a solid background color I'd like to have interchangeable pictures and patterns.

jaynabonne
Ah, I see. I'm behind the times on that feature. :)

There is a SetBackgroundImage function you can call whenever you wish to set the background image. It does mean you'd have to put a call into a "Before/After entering room" script, but you could do it.

chrisw70
Do you know where I'd find an example of how to write that kind of call function to swap background images? I'm still learning the ropes with the GUI and trying to piece things together by looking at what others have done so far, but haven't found anything that relates to that.

jaynabonne
Here's an example I just did. I added a script to the "Before entering the room" script for a room. You can find the "Call function" script under the "Scripts" category. Set the function name to SetBackgroundImage, and add a parameter, which is the image name in quotes. You also need to copy the image to the same folder where your game file is located.
setbackgroundimage.png

chrisw70
Awesome, thank you!

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums