Adventure-Style Screen Navigation with Example, am I doing it right?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Devon Andersson
Newbie
Posts: 7
Joined: Sun Nov 12, 2017 9:10 am
Contact:

Adventure-Style Screen Navigation with Example, am I doing it right?

#1 Post by Devon Andersson »

I wanted to create a game where the player navigates to various locations by clicking on things like doors. There should be no dialog while moving around. The player is not visible while doing this. Each location in the game has its own screen.

Since my real project is to big and NSFW (Adult game) I created a small testproject for this.
To be clear: This works perfectly for me. But my actual question is: Is this the proper way to do this?

https://imgur.com/a/ZIl9e

customscreens.rpy

Code: Select all

screen house_outside():
    tag adventure
    frame:
        background "images/bg house outside.png"
        ## USE DOOR
        imagebutton auto "gui/imagebutton_%s.png" xpos 570 ypos 295 action Show("house_inside")
        ## LOOK THROU WINDOW
        imagebutton auto "gui/imagebutton_%s.png" xpos 900 ypos 250 action Show("house_lookinside")
        ## TALK
        imagebutton auto "gui/imagebutton_%s.png" xpos 60 ypos 370 action Jump("testdialog")

screen house_inside():
    tag adventure
    frame:
        background "images/bg house inside.png"
        ## BOX
        imagebutton auto "gui/imagebutton_%s.png" xpos 660 ypos 330 action Notify("There is kinky stuff inside the box!")
        ## GO BACK OUTSIDE
        imagebutton auto "gui/imagebutton_%s.png" xpos 1140 ypos 460 action Show("house_outside")

screen house_lookinside():
    tag adventure
    frame:
        background "images/bg house lookinside.png"
        ## GO BACK
        imagebutton auto "gui/imagebutton_%s.png" xpos 570 ypos 620 action Show("house_outside")
script.rpy

Code: Select all

define testa = Character("Testcharacter A")
define testb = Character("Testcharacter B")

label start:
    scene bg room
    testa "The game started and this is an intro-dummy."
    jump start_adventure_mode
    return

## Setup adventure-mode with first screen
label start_adventure_mode:
    window hide
    show screen house_outside
    jump adventure

## A endless loop with pause
## used to stop all dialogs and navigate screens only with imagebuttons
label adventure:
    ## Disable rollback here because every click create a *rollback-event* in Ren'Py
    ## I don't want that for 'adventure-mode'
    $ renpy.block_rollback()
    pause
    jump adventure
    
label testdialog:
    testa "Hi! You like the nice weather?"
    testb "No, to many bees!"
    testa "ohh ... bye!"
    jump start_adventure_mode    
Attachments
screenshot.png
AdventureStyleTest.zip
(810.89 KiB) Downloaded 14 times

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]