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."
-- No LipFlap animations, just transitioning expressions and occasionally arms. (LipFlap gives me the creeps.)
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"
)