Code: Select all
# action - continue the game from there, where finished
# if there is nothing to upload yet, the button is inactive
# textbutton _ ("Continue game") action Continue ()
init -999 python
class Continue (Action, DictEquality):
def __call __ (self):
FileLoad (1, confirm = False, page = "auto", newest = True) ()
# clickable button
def get_sensitive (self):
return FileLoadable (1, page = "auto")
2) advanced
First, we'll make a record at the very beginning of script.rpy
Code: Select all
label main_menu:
call screen main_menu
label restart:
call screen confirm (message = u "Are you sure you want to restart the game?", yes_action = Start (), no_action = Jump ("main_menu"))
### Auto-save activation:
init -1 python hide:
config.has_autosave = True
Code: Select all
screen navigation ():
vbox:
style_prefix "navigation"
xpos gui.navigation_xpos
yalign 0.5
spacing gui.navigation_spacing
if main_menu:
textbutton _ ("Start Game") action Jump ("restart")
else:
textbutton _ ("History") action ShowMenu ("history")
textbutton _ ("Save") action ShowMenu ("save")
textbutton _ ("continue") action FileLoad (1, confirm = False, page = "auto", newest = True)
textbutton _ ("Load game") action ShowMenu ("load")
textbutton _ ("Options") action ShowMenu ("preferences")
When you click on the Start Game button, we call the restart label, which displays the notification screen message (confirm - on new, on old - yesno_prompt) in which you specify whether you want to start a new game.
And by clicking on the Continue game button, we automatically load the last auto save. Thanks to the fact that we registered the activation of autosave, we will load our last place where we stopped.
3) Use [`action Continue()`](https://www.renpy.org/doc/html/screen_a ... l#Continue) added since version 8.1.1
Something like this:
Code: Select all
screen navigation():
vbox:
if main_menu:
if renpy.newest_slot != None:
textbutton _("Continue") action Continue()
else:
textbutton _("New game") action Start()