minigames on new context

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Moshibit
Regular
Posts: 50
Joined: Wed Oct 16, 2019 1:58 pm
Location: Mexico
Contact:

minigames on new context

#1 Post by Moshibit »

I have seen many visual novels with mini-games, where they eliminate the rollback feature. I bring a solution so that this feature is not eliminated.

This is just an example.

Code: Select all

init python:

    class NoRollObj(NoRollback):
        def __init__(self, v):
            self.value = v

default ctrlnc = NoRollObj(False)
default points = NoRollObj(0)

label start:
    "..."
    "..."
    if ctrlnc.value == False:
        $ renpy.call_in_new_context("rock_paper_scisors")
    $ ctrlnc.value = True
    "..."
    "..."
    
label rock_paper_scisors:
    show screen rps
    $ points += 1
    return
In the new context it is not allowed to rollback, when making a code structure like the one in the example, it is allowed to make a rolback in the story, without playing the minigame again and the result is not lost.

Post Reply

Who is online

Users browsing this forum: No registered users