P
polartropics
Guest
So i have a main menu, and a few test levels, i also have a save and load feature. it works fine, except the whole game is persistent. its an RPG game so when i load the stats i had when saved and the room i was in when saved becomes the current room and stats. It all works fine except when you create a new game from the main menu.
My thinking was when you press "New Game" you need to reset the whole game, i looked this up and the code for this is rather straight forward game_restart();. except it does literally nothing. the current room is not the starting room, the stats are the same and all the killed enemies are still gone. my solution was to reset the stats and make the current room = starting room, this works except, if you've killed any enemies or collected anything, then theyre still dead or missing because every room is persistent. I thought game_restart(); wouldve solved this but it doesnt. Nnow its looking like im either going to write a huge slow code;
rm_firstroom.persistent = false;
room_restart();
rm_firstroom.persistent = true;
rm_secondroom.persistent = false;
room_restart();
rm_secondroom.persistent = true;
...cont. for a hundred levels
and i really dont think this is the best way of going about this
so more likely im going to have to make the main menu inaccessible from the pause menu so if you want to start a new game, you need to manually exit and restart the game. and make the "New Game" button just send you to the starting room. Save and Load are in the pause menu so you could load at anypoint but you cant start again without exiting and starting the game from windows and that sucks.
Any ideas?
My thinking was when you press "New Game" you need to reset the whole game, i looked this up and the code for this is rather straight forward game_restart();. except it does literally nothing. the current room is not the starting room, the stats are the same and all the killed enemies are still gone. my solution was to reset the stats and make the current room = starting room, this works except, if you've killed any enemies or collected anything, then theyre still dead or missing because every room is persistent. I thought game_restart(); wouldve solved this but it doesnt. Nnow its looking like im either going to write a huge slow code;
rm_firstroom.persistent = false;
room_restart();
rm_firstroom.persistent = true;
rm_secondroom.persistent = false;
room_restart();
rm_secondroom.persistent = true;
...cont. for a hundred levels
and i really dont think this is the best way of going about this
so more likely im going to have to make the main menu inaccessible from the pause menu so if you want to start a new game, you need to manually exit and restart the game. and make the "New Game" button just send you to the starting room. Save and Load are in the pause menu so you could load at anypoint but you cant start again without exiting and starting the game from windows and that sucks.
Any ideas?