Mini game screen rollbacks after load

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
keresteci
Newbie
Posts: 4
Joined: Wed Nov 07, 2018 7:58 am
Contact:

Mini game screen rollbacks after load

#1 Post by keresteci »

Hello, I added "fable 2" mini game from viewtopic.php?f=51&t=47820&start=15 this topic to my game, modified a little but i have a problem. Saving the game after playing the mini game, then loading that saved game, rollbacks the game to the mini game. I think it calls itself when starting the saved daya. How can I overcome this?
Here's the code:

Code: Select all

init 15 python:
        fable_minigame_bar = 45
        fable_minigame_score = 0
        fable_you_press_button = 0
    init:
        transform fable_point_move(frp):
            subpixel True
            rotate_pad True
            align(0.5,1.22)
            rotate frp
    screen fable_2_minigame:
        add "minigame/Fable_bar.png" align(0.5,0.5)
        add "minigame/Fable_point.png" at fable_point_move(fable_minigame_bar)

        if fable_minigame_bar >= -7 and fable_minigame_bar <= 7:
            key "K_SPACE":
                if fable_you_press_button == 0:
                    if fable_minigame_score < 0:
                        action [SetVariable("fable_minigame_score", fable_minigame_score + 1), SetVariable("fable_you_press_button", fable_you_press_button + 1), Show("you_press_button_good")]
                    else:
                        action Jump("end")
                elif fable_you_press_button == 1:
                    action SetVariable("fable_minigame_score", fable_minigame_score + 0)
        else:
            key "K_SPACE" action [SetVariable("fable_minigame_score", 0), Jump("endd")]

    screen fable_timer_left:
        timer 0.00001 repeat True action [If(fable_minigame_bar >= -45, SetVariable("fable_minigame_bar", fable_minigame_bar - 1)),If(fable_minigame_bar == -45, Hide("fable_timer_left"), Show("fable_timer_right")), If(fable_minigame_bar == -45, SetVariable("fable_you_press_button", 0)), If(fable_minigame_bar == -45, Jump("endd"))]
    screen fable_timer_right:
        timer 0.00001 repeat False action [If(fable_minigame_bar <= 45, SetVariable("fable_minigame_bar", fable_minigame_bar + 1)),If(fable_minigame_bar == 45, Hide("fable_timer_right"), Show("fable_timer_left")), If(fable_minigame_bar == 45, SetVariable("fable_you_press_button", 0))]
And this is how I call it:

Code: Select all

jump start_minigame
    label start_minigame:
    show screen fable_timer_left
    call screen fable_2_minigame
After this there's two labels "end" and "endd", game always jumps on label "endd" after loading because its the failure label.

TL;DR: How can I prevent calling of a previous screen after loading the game? It mades the game rollback.
Thank you.

Post Reply

Who is online

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