Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Wed Jun 19, 2013 4:38 am

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Mon May 21, 2012 7:37 pm 
Eileen-Class Veteran
User avatar

Joined: Fri Mar 09, 2012 6:58 pm
Posts: 1173
Location: United States
Projects: Coming Out On Top
The original article on the wiki has a bit of an error that can really throw newbie programmers for a loop.
I'm just adding the missing apostrophes for future reference. :mrgreen:

Edit: 6/2/2012. Another newbie edit. If you use folders, the original cookbook suggests "/folder/image.png". There is no need for that first slash!!! Removed that first slash from the comment below.

-----------------------------------------
Showing layered sprites with different emotions

Have you ever wanted to make a layered image but you didn't want to declare separate statements for each one? Are you tired of using "show eileen happy at center with dissolve"?

Then this is for you! Welcome to the world of LiveComposite and dynamic displayables using ConditionSwitch! You'll only need to declare something like "$ Janetmood = mad" to change the emotion on her face or the pose and any number of fun things.
Code:
#Put this in your init section!
init:
#This declares a conditional image with a LiveComposite inside of it
image eileen = ConditionSwitch(
            "e_face == 'happy'", LiveComposite(
                #If she's happy, call the LiveComposite
                (375, 480),
                (0, 0), "e.png",
                #This is the size of the sprite in widthxheight of pixels
                #I'm telling it not to move e.png but use the base dimensions and
                #the path to e.png. If I had it in a folder, it would be
                #"foldername/imagename.format"
                #This is probably the "base" image or body.
                (94, 66), "e_happy.png",
                #This is 94 pixels to the right and 66 pixels down, if I remember correctly
                #This is the alternate face layer, which is put on top of the stack.
                #So the order goes bottom to top when you're listing images.
                ),
            "e_face == 'sad'", LiveComposite(
                (375, 480),
                (0, 0), "e.png",
                (94, 66), "e_sad.png",
                #Don't forget your commas at the end here
                ),
            "e_face == None", "e.png")
            #If it's not set to anything, the neutral base "e.png" displays
            #Be sure to close your parentheses carefully

label start:
#This is how you call it during the game itself
show eileen
#This shows the LiveComposite "e.png" when e_face == None. We haven't changed it yet.
e "I'm neutral."
#Now we change the variable to happy.
$ e_face = "happy"
e "Now sprite is happy!"
#You can also declare ConditionSwitches in Character statements to
#change the side image.

_________________
Coming Out On Top - An Adult B/B Game
Wordpress Tumblr Twitter FB


Last edited by Obscura on Sat Jun 02, 2012 7:57 pm, edited 1 time in total.

Top
 Profile Send private message  
 
PostPosted: Wed May 30, 2012 7:48 pm 
Regular
User avatar

Joined: Sun Aug 01, 2010 1:21 pm
Posts: 137
Excuse my ignorant question, but is it possible to use transitions with this method?


Top
 Profile Send private message  
 
PostPosted: Thu May 31, 2012 3:42 am 
Eileen-Class Veteran
User avatar

Joined: Fri Mar 09, 2012 6:58 pm
Posts: 1173
Location: United States
Projects: Coming Out On Top
Samidarenina wrote:
Excuse my ignorant question, but is it possible to use transitions with this method?


This is actually an excellent question. I'm looking for the answer to it myself!!!

_________________
Coming Out On Top - An Adult B/B Game
Wordpress Tumblr Twitter FB


Top
 Profile Send private message  
 
PostPosted: Fri Jun 01, 2012 2:51 pm 
Veteran
User avatar

Joined: Mon Nov 22, 2010 10:52 am
Posts: 345
Location: Germany
Projects: 1plus3
I use a different method (composite, building the expression in-game) but what I do is to have a backup of the character and switching between them.
(Eileen and Eileen2, both are linked to the speaker (especially important if you use lip flap).)
I change the expression in 2, use a transition and switch back to 1, then again to 2, then to 1...
Not elegant but it works. =o

- R.

_________________
Image
Image
Image


Top
 Profile Send private message  
 
PostPosted: Sat Jun 02, 2012 7:56 pm 
Eileen-Class Veteran
User avatar

Joined: Fri Mar 09, 2012 6:58 pm
Posts: 1173
Location: United States
Projects: Coming Out On Top
Ryouko wrote:
I use a different method (composite, building the expression in-game) but what I do is to have a backup of the character and switching between them.
(Eileen and Eileen2, both are linked to the speaker (especially important if you use lip flap).)
I change the expression in 2, use a transition and switch back to 1, then again to 2, then to 1...
Not elegant but it works. =o

- R.


Hmmm...that's an interesting and clever way to do it! It seems there must be some way of doing it so it's not so redundant.

_________________
Coming Out On Top - An Adult B/B Game
Wordpress Tumblr Twitter FB


Top
 Profile Send private message  
 
PostPosted: Sun Jun 03, 2012 8:42 am 
Regular
User avatar

Joined: Sun Aug 01, 2010 1:21 pm
Posts: 137
Wouldn't it be possible to define 2 pictures as one picture? And then just use it as normal sprites?


Top
 Profile Send private message  
 
PostPosted: Sun Jun 03, 2012 8:52 am 
Crawling Chaos
User avatar

Joined: Mon Feb 13, 2012 5:37 am
Posts: 1148
Location: Kimashi Tower, Japan
Completed: SMAR,AAA
Projects: DMC
I'm not sure but is it what you're looking for?
http://www.renpy.org/doc/html/displayab ... .Composite

_________________


Top
 Profile Send private message  
 
PostPosted: Fri Mar 29, 2013 1:56 pm 
Regular
User avatar

Joined: Thu Mar 28, 2013 7:50 am
Posts: 27
Projects: Cupcake! [WIP-40%] :: Riddled [Idea-0%]
Hello! This is quite a helpful code. Sorry if the questions give hints at my noobness haha.

1. Does the init go to the main script or the separate script?
2. Is there a way to place image scripts as a separate rpy file and call them on the main script?
3. Instead of 9 mouths, 4 eyes and 5 eyebrows, would it be easier to call whole faces? I'm just concerned with the placement of the images since the graphics might look just a hairline off but still produce weird results.

Thanks!


Top
 Profile Send private message  
 
PostPosted: Fri Mar 29, 2013 2:54 pm 
Eileen-Class Veteran
User avatar

Joined: Fri Mar 09, 2012 6:58 pm
Posts: 1173
Location: United States
Projects: Coming Out On Top
Sabotage wrote:
Hello! This is quite a helpful code. Sorry if the questions give hints at my noobness haha.

1. Does the init go to the main script or the separate script?
2. Is there a way to place image scripts as a separate rpy file and call them on the main script?
3. Instead of 9 mouths, 4 eyes and 5 eyebrows, would it be easier to call whole faces? I'm just concerned with the placement of the images since the graphics might look just a hairline off but still produce weird results.

Thanks!


Someone please correct my explanations here, as I'll make my best attempts using butchered terminology and a tenuous grasp of RenPy. (Note to Sabotage--I'm actually having someone far more skilled than I am doing the harder programming tasks, thank goodness.)

1. I believe "init:" indicates wherever you want RenPy to start executing code. It can go into an .rpy file you want...that's where the computer will start following instructions (and initializing variables, etc.). Everything under init is run every time the program is run.

2. if you mean the sprite images? or the the background images? yes, you can declare all your background images in one .rpy file, and sprite images in another. Just make sure init: is at the top of those .rpy files, so RenPy knows to run all of them (initialize them) before it actually starts the code for the game. You can even put numbers after "init" to tell RenPy which order to run the .rpy files you've got. Init: will be executed before init 2:, for example.

3. Yes, people use all sorts of methods to create expressions. If all of your layers are exactly the same size (imagine a transparent layer with a single mouth that you precisely over a same-sized layer with a body), everything will already be placed exactly where it needs to be, and RenPy will stack them for you. Personally, I put a lot of time and energy combining the different eyebrows, eyes, and mouths together, though numerous artists won't use this method because they feel the entire expression should be captured in the pose of the body itself. I'm all about facial expressions though, so I currently have 70 different expressions coded for my main character to be used throughout my game. It's very much a personal preference.

_________________
Coming Out On Top - An Adult B/B Game
Wordpress Tumblr Twitter FB


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group