Fangames > Programming Questions
How to load a changed background inside the room?
(1/1)
l3agu32:
I'm using game maker studio. In my game I put the option to change the background_index when you're inside the room, but when I load the game pressing R, the original background appears again. I want to know how to save the background changed when saving the game, so that when loading, the background_index changed is what appears instead of the original background.
Smartkin:
I suggest creating some sort of flag for example "global.BCGchanged". Then change it to 1 when you change background index. After that in the save game script add "global.BCGchanged":
file_bin_write_byte(f,global.BCGchanged)
In load game scrypt(Usually presented as saveExe) assign the previously saved value to the global.BCGchanged:
global.BCGchanged = file_bin_read_byte(f);
Remember to have them at the same position if you save it after global.item[X] then load it at the same position. Idk if it is necessary in Studio since I work in 8.1 but test both in any case.
Then in room Creation Code:
If global.BCGchanged
background_index[0] = (your background index);
If you want to have multiple changes can have it into array.
Hope it worked and good luck making fangames :atkHappy:
Navigation
[0] Message Index
Go to full version