[Solved] A way to advance through the scenes playing a minigame?

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
Adrian_DVL
Regular
Posts: 141
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

[Solved] A way to advance through the scenes playing a minigame?

#1 Post by Adrian_DVL »

Hi mates!

Here's the thing: I have a minigame built on a modal screen, so while the minigame is working, the player can't go to the next images in the background.
Now, the minigame has several phases, so the player has to win a certain amount of "points" in order to win. So I want the game to go through the scenes that are showing in the background as the player wins each point. I mean, if I have the VN part of the game like this:

Code: Select all

scene img1
pause
scene img2
pause
scene img3
...
I'd like the game to detect when the player earns a point in the minigame (i.e. in a completely different label) and to advance to the next scene and show the next image beyond each pause. Is that possible? Is there any function or something that allows me to do that?
Last edited by Adrian_DVL on Sun Apr 05, 2020 7:16 am, edited 1 time in total.

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: A way to advance through the scenes playing a minigame?

#2 Post by Kia »

easy, put something like this inside your minigame

Code: Select all

modal True
timer .5 repeat True action If(points > 100, Return())
a return inside a modal screen does the same thing as if the player have clicked

Adrian_DVL
Regular
Posts: 141
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Re: A way to advance through the scenes playing a minigame?

#3 Post by Adrian_DVL »

Kia wrote: Sun Apr 05, 2020 5:56 am easy, put something like this inside your minigame

Code: Select all

modal True
timer .5 repeat True action If(points > 100, Return())
a return inside a modal screen does the same thing as if the player have clicked
Wow! I didn't know that! Sounds promising, the problem is that it gave me a traceback saying that a timer must have an action supplied (which actually has, I don't understand the error). Another problem might be that all what happens in the minigame, it happens in several labels, not in the screen. The screen is just the visual representation of it. The label, simplifying it a lot, is something like this:

Code: Select all

label mini(mst=1):
	...
	label mini_loop:
		...
		label turns:
		...
	$ memgoodp += 1  <--- This is the variable I want the game to react to and change the scene!
        $ memtotalp += 1
As you can see, it is inside the second label where I want the game to progress through the scenes, that's why I was asking for some kind of function. I didn't even understand why the timer didn't work, though.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: A way to advance through the scenes playing a minigame?

#4 Post by Remix »

You do not need to manually scene/show/replace the background image, you can just have it as a dynamic...

Code: Select all

default memgoodp = 0
image dynamic_background = "images/background_[memgoodp].png"

label start:
    scene dynamic_background ## showing "images/background_0.png"
    "..."
    $ memgoodp += 1
    ## now showing "images/background_1.png" automagically
Frameworks & Scriptlets:

Adrian_DVL
Regular
Posts: 141
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Re: A way to advance through the scenes playing a minigame?

#5 Post by Adrian_DVL »

Remix wrote: Sun Apr 05, 2020 7:01 am You do not need to manually scene/show/replace the background image, you can just have it as a dynamic...

Code: Select all

default memgoodp = 0
image dynamic_background = "images/background_[memgoodp].png"

label start:
    scene dynamic_background ## showing "images/background_0.png"
    "..."
    $ memgoodp += 1
    ## now showing "images/background_1.png" automagically
And here's the solution I was expecting- Thank you very much! Dynamics always solve problems!

Post Reply

Who is online

Users browsing this forum: Google [Bot]