[Solved]Doubt about the screen

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.
Message
Author
User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Doubt about the screen

#16 Post by trooper6 »

Hm...that seems to be a bit trickier because of sprites and backgrounds. Give me a few more minutes...
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Doubt about the screen

#17 Post by trooper6 »

Okay, I tested this and this will work. I used textbuttons, but you can replace them with imagebuttons, of course.

Code: Select all

define config.layers = ['master', 'memory', 'transient', 'screens', 'overlay']
define config.tag_layer={"mem":"memory"}

screen logo():
    textbutton "Logo" action If(renpy.get_screen("ghost"), Hide("ghost"), ShowTransient("ghost"))

screen ghost():
    textbutton "Ghost" action Call("remember") align (1.0, 0.0)#Hide("ghost")

# The game starts here.
label start():
    scene underpass
    show jack at left
    show screen logo()
    "Game starts"
    "Here I am."
    "Walking down the street"
    "Now the game is over."
    return

label remember():
    hide screen logo
    show background mem as background2 
    show jack mem as jack2 at right
    with dissolve
    "Oh I remember..."
    "Back in the day..."
    "Memory over."
    hide background
    hide perry
    with dissolve
    show screen logo()
    return
Let me tell you what you are seeing here, from the top.
I created a new layer called "memory" and it is above the "master" layer and below the other layers.
Next, I noted that if I use the tag "mem" I want whatever that is to be put on the "memory" layer.

Onto the Screens.
The Logo screen will have that Logo button. if you click that button if will show the ghost button. If the ghost button is already visible, clicking it will make the ghost button disappear. I also use ShowTransient rather than Show, this means that if you click on anything to move the game forward, that ghost image will disappear.

The game starts...
You show that logo screen and the game starts. At any time you can click on the Logo button and from there, if you want you can click on the Ghost button. When you click on the ghost button you call this memory label.

IMPORTANT TO NOTE ABOUT THE MEMORY LABEL!
What is happening here is this label is going to put things on the memory layer (this is why you are calling things with "mem") which is on top of the master layer. The stuff on the master layer is still there! For this to work, you need to do a few things.
1) Make sure you show your images using the "mem" tag, which puts it on the memory layer.
2) Make sure you show your images *as* something else, so it doesn't get rid of whatever is happening on the master layer
3) When you are done you need to hide all the things you showed, which will reveal what is still happening on the master layer.
I also got rid of the Logo screen because they shouldn't be able go into the memory from the memory. If you want the logo still visible, just replace it with a new screen that has the logo image...but not as a button so it doesn't do anything.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

zabuzaeldemonio
Regular
Posts: 103
Joined: Sun Jan 08, 2017 7:24 pm
Projects: Call Me
Location: Spain
Contact:

Re: Doubt about the screen

#18 Post by zabuzaeldemonio »

Thank you very much, it has really helped me.
My personal Project:
Image

Post Reply

Who is online

Users browsing this forum: No registered users