LiveComposite Template Game

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
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

LiveComposite Template Game

#1 Post by OokamiKasumi »

LiveComposite Template
One of the ways I figure out how to do things in Renpy is by making a Template game. Once I have the code actually working the way I want it, I can simply copy/paste the code straight from the template into as many projects as I like.

The idea behind this particular template was to figure out how to have characters that changed positions and expressions. After rooting around through all the tutorials posted on DynamicDisplayables, I started fiddling with ConditionSwitch and LiveComposite. However, I really didn't like how ConditionSwitch made the expressions just snap from one to the next, so for purely aesthetic reasons, I decided to go with strictly LiveComposite.

One of more interesting things I recently discovered when using LiveComposite is that using "show" alone will change the image no matter where it's positioned on the screen. In other words, you don't need to add the character's position "at right" when you "show" a new expression.

Example:

Code: Select all

    show ElenaG smile with dissolve 
    y "One of the most interesting features of LiveComposite is that simply using {b}'show'{/b} --all by itself-- works no matter where the character is positioned."
    
    show IvanP worry with dissolve
    iv "Oh, so that means if I move over here..."
    show IvanP worry at right with move
    
    show ElenaG smile at left with move
    y "And I move over here..."

    iv "--and I use {b}IvanP worryL with dissolve{/b} to change my expression, without adding {b}'at right'{/b}, it still works?"
    show IvanP worryL with dissolve 

    show ElenaG smileR
    y "That's right."
    
    show IvanP worry with dissolve
    iv "Huh... That {i}is{/i} interesting."
So, this is my LiveComposite Template.
-- No LipFlap animations, just transitioning expressions and occasionally arms. (LipFlap gives me the creeps.)
LC_screenshot0.jpg
LC_screenshot1.jpg
LiveComposite-2.0-all.zip
(35.43 MiB) Downloaded 2174 times
or
Download from MediaFire 35 MB
Updated! Ver. 2.0

Feel free to play with it however you like. The files and graphics are all un-archived so they can be swapped around and fiddled with to your heart's content. :) The code all came from this forum, so I can't claim any of it. The images however, are all mine. (If you really want to use them, please ask. 'Kay?)

The Code:

Code: Select all

########################################
## LiveComposite code for Elena.
# Be extremely mindful of the Commas & the ( ) Parentheses!!!

init-2:
## ------------- Elena Princess -------------------
    image ElenaG = "ch/E_g/E_Gr.png"

    # Note: The actual png image is E_gr.png. The prefex ch/E_g/ stands for the folders it's in. 
    # The folder (E_g) is within another folder (ch) inside the game folder. 

    image ElenaG smile = LiveComposite(
            (465, 760), # Width x Height
            (0, 0), "ch/E_g/E_Gr_00.png", # base
            (0, 0), "ch/E_g/E_Gr_h_smile0.png", # head
            (0, 305), "ch/E_g/E_Gr_a_1.png" # arms: How far to the Right; in this case 0px, by how far Down from Top of the image's height. The full image is 760px, so 305px down from 760. Often merely the height of the Head image. 
            )

    image ElenaG smileL = LiveComposite(
            (465, 760), 
            (0, 0), "ch/E_g/E_Gr_00.png", 
            (0, 0), "ch/E_g/E_Gr_h_smileL.png", 
            (0, 305), "ch/E_g/E_Gr_a_1.png"
            )

    image ElenaG smileR = LiveComposite(
            (465, 760), 
            (0, 0), "ch/E_g/E_Gr_00.png", 
            (0, 0), "ch/E_g/E_Gr_h_smileR.png", 
            (0, 305), "ch/E_g/E_Gr_a_1.png"
            )

    image ElenaG neu = LiveComposite(
            (465, 760), 
            (0, 0), "ch/E_g/E_Gr_00.png", 
            (0, 0), "ch/E_g/E_Gr_h_Neu0.png", 
            (0, 305), "ch/E_g/E_Gr_a_2.png"
            )

    image ElenaG neuR = LiveComposite(
            (465, 760), 
            (0, 0), "ch/E_g/E_Gr_00.png", 
            (0, 0), "ch/E_g/E_Gr_h_NeuR.png", 
            (0, 305), "ch/E_g/E_Gr_a_2.png"
            )

    image ElenaG neuL = LiveComposite(
            (465, 760), 
            (0, 0), "ch/E_g/E_Gr_00.png", 
            (0, 0), "ch/E_g/E_Gr_h_NeuL.png", 
            (0, 305), "ch/E_g/E_Gr_a_2.png"
            )

    image ElenaG annoy = LiveComposite(
            (465, 760),
            (0, 0), "ch/E_g/E_Gr_00.png",
            (0, 0), "ch/E_g/E_Gr_h_annoy0.png", 
            (0, 305), "ch/E_g/E_Gr_a_3.png"
            )
        
    image ElenaG annoyL = LiveComposite(
            (465, 760),
            (0, 0), "ch/E_g/E_Gr_00.png",
            (0, 0), "ch/E_g/E_Gr_h_annoyL.png", 
            (0, 305), "ch/E_g/E_Gr_a_3.png"
            )

    image ElenaG annoyR = LiveComposite(
            (465, 760),
            (0, 0), "ch/E_g/E_Gr_00.png",
            (0, 0), "ch/E_g/E_Gr_h_annoyR.png", 
            (0, 305), "ch/E_g/E_Gr_a_3.png"
            )
        
    image ElenaG worry = LiveComposite(
            (465, 760),
            (0, 0), "ch/E_g/E_Gr_00.png",
            (0, 0), "ch/E_g/E_Gr_h_worry0.png", 
            (0, 305), "ch/E_g/E_Gr_a_2.png"
            )

    image ElenaG worryL = LiveComposite(
            (465, 760),
            (0, 0), "ch/E_g/E_Gr_00.png",
            (0, 0), "ch/E_g/E_Gr_h_worryL.png",
            (0, 305), "ch/E_g/E_Gr_a_2.png"
            )
    
    image ElenaG worryR = LiveComposite(
            (465, 760),
            (0, 0), "ch/E_g/E_Gr_00.png",
            (0, 0), "ch/E_g/E_Gr_h_worryR.png", 
            (0, 305), "ch/E_g/E_Gr_a_2.png"
            )
I'm not kidding about being careful with your commas and parentheses. I literally spent hours hunting down an error that turned out to be ONE misplaced comma.
Last edited by OokamiKasumi on Sun Dec 15, 2013 4:47 pm, edited 10 times in total.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
merdeamour
Veteran
Posts: 307
Joined: Sun Apr 21, 2013 10:23 pm
Projects: Taleweaver's Curse
Location: Philippines
Contact:

Re: LiveComposite Template game

#2 Post by merdeamour »

Ah, cool! :D I struggle with Live Composite, too. I didn't like the way expressions change too abruptly with ConditionSwitch, either.

P.S. Beautiful art--I love it!
What would life be if we had no courage to attempt anything?
-Vincent van Gogh
I manage a blog, Another Otome Diary where I give my two cents on otomes I've played. Check it out, or let me know if you want a game of yours reviewed!

User avatar
Obscura
Eileen-Class Veteran
Posts: 1431
Joined: Fri Mar 09, 2012 6:58 pm
Projects: Coming Out On Top
Location: United States
Contact:

Re: LiveComposite Template game

#3 Post by Obscura »

Wow thanks for creating this! Dissolving sprites seems like it's always been a bit of an interesting issue with RenPy, with many ways to approach it.

Only thing I'd like to mention is that the code I posted was merely a copy and paste off the RenPy wiki, so I cannot take credit for the LiveComposite code. (That's probably apparent to most people going through your game, but I just wanted to make that clear.)

The way I'm currently handling transitions is the way that was set up by Saguaro and used by other members of this forum, which is to have two versions of the sprites dissolving into each other. The way you've presented it here is a useful alternative. It's good to know!
Coming Out On Top - An Adult Gay Dating Sim
website

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: LiveComposite Template game

#4 Post by OokamiKasumi »

@ merdeamour
merdeamour wrote:Ah, cool! :D I struggle with Live Composite, too. I didn't like the way expressions change too abruptly with ConditionSwitch, either.
This is what I've come up with so far, but then I'm not all that skilled at coding. Elegant solutions are well beyond my scope. I was never good at doing math in my head. :)
merdeamour wrote:P.S. Beautiful art--I love it!
LOL Thank you!
~~~~~~~~~~~~~~~~~~~~~~~

@ Obscura
Obscura wrote:Wow thanks for creating this! Dissolving sprites seems like it's always been a bit of an interesting issue with RenPy, with many ways to approach it.
So I've seen, but most of those solutions are way too complicated for me to grasp. This I can wrap my brain around.
Obscura wrote:The way I'm currently handling transitions is the way that was set up by Saguaro and used by other members of this forum, which is to have two versions of the sprites dissolving into each other.
Whoa! I haven't seen that one! I don't think...? Is this technique posted somewhere? (Was I supposed to dig through a released game to find it?)
Obscura wrote:The way you've presented it here is a useful alternative. It's good to know!
LiveComposite is a bit like doing long division, verses the algebra of ConditionSwitch.
-- I suck at Algebra. Long division I can do, and Geometry I can do in my head. The point being, if I can see how something works, I can use it. I'm glad you like it!
Obscura wrote:Only thing I'd like to mention is that the code I posted was merely a copy and paste off the RenPy wiki, so I cannot take credit for the LiveComposite code. (That's probably apparent to most people going through your game, but I just wanted to make that clear.)
It's written very clearly on your post. Anyone visiting that link would get the point. I felt that mentioning it again in my template was over-kill.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

Post Reply

Who is online

Users browsing this forum: Zahdernia