Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //obj_saveload create event
- global.levelData = {}; //Initialize empty struct, leave it completely blank!
- //--------save_room function
- function save_room(){
- var _room_struct = {
- }
- //Save all of your things here normally, like in the video.
- //Store room NAME struct in global.levelData
- global.levelData[$ room_get_name(room)] = _room_struct;
- }
- function load_room(){
- var _room_struct = 0;
- //Simply get the levelData from the room's NAME we are in!
- _room_struct = global.levelData[$ room_get_name(room)];
- //Just in case some weird stuff happens, exit!
- if(is_undefined(_room_struct)){
- exit;
- }
- if(!is_struct(_room_struct)){
- exit;
- }
- //Load all your stuff here, like in the video
- }
- //The save game and load game functions stay the same. Now you won't have to worry about creating a new struct for every room!
- //Remember: Once you release your game, you cannot rename your rooms, or any assets really, as this will absolutely cause save file corruption and your players will be very angry!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement