Displaying several backgrounds (solved)

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
Lina
Newbie
Posts: 10
Joined: Thu Jan 05, 2012 2:11 pm
Contact:

Displaying several backgrounds (solved)

#1 Post by Lina » Sun Jan 08, 2012 12:35 am

I'm trying to show a set of background images at the beginning of my game without any text or character sprites. To set the mood so to say.
But I'm obviosly doing something wrong and I can't figure it out. My code so far looks like this:

Code: Select all

label start:
    scene bg bird
    scene bg gras
So, the first image the player looks at is a bird. When he clicks with his mouse, the next image should be the gras. However, the game starts right away with the gras.

I've tried it with

Code: Select all

scene bg bird with dissolve
and that worked a little bit. Except that the game menu and the bird were dissolving, not the bird and the gras. Also, the bird disapeared too quickly and it should only disappear when the player clicks with the mouse. I realize that this is probably a really silly question, but I'm a bit lost here and would appreaciate any help.
Last edited by Lina on Sun Jan 08, 2012 7:03 am, edited 1 time in total.

User avatar
DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Displaying several backgrounds

#2 Post by DragoonHP » Sun Jan 08, 2012 12:48 am

That is because you didn't tell Ren'Py to stop there...

Code: Select all

$ renpy.pause()

User avatar
MoPark
Regular
Posts: 98
Joined: Sat Dec 31, 2011 7:05 pm
Projects: Kangaroo, Terminal Love
Location: DC
Contact:

Re: Displaying several backgrounds

#3 Post by MoPark » Sun Jan 08, 2012 3:45 am

Overall note on coding in general:

Programs will execute line-by-line. In your example, it read "scene bg bird" and executed it, but then read the next line "scene bg gras" and executed that immediately afterwards, before continuing to the next line. Since we're running modern systems, it executes those lines so quickly that you ended up not seeing the bird bg at all, because it immediately read the next line and did that.

This is why you need pauses and other such methods in your program (timed transitions, menus, etc). If you had no pauses whatsoever, it could run everything in a second or two and that'd be your entire game in a blink of an eye!

This is my simplified and likely not terribly technical explanation for why your problem happened, and DragoonHP provides the solution for it.

Lina
Newbie
Posts: 10
Joined: Thu Jan 05, 2012 2:11 pm
Contact:

Re: Displaying several backgrounds

#4 Post by Lina » Sun Jan 08, 2012 7:02 am

Thank you, you two. That has solved my problem and made the whole thing clearer for me.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], TioNick