@ Obscura :
So glad to hear from you ! Like I said, your project is a great inspiration, and really motivated us to finally begin our own game. Thanks for your offer to talk about our game on your forum, so far there's not much to pitch... but I hope this will soon evolve into a game. We'll be sure to talk about your game too, I've hopefully sold a few copies the other day when I showed the demo to some friends.
My big fear on our project is wanting to do too much for a first try, and not finishing it... so we'll begin small. Once the base coding is done and working, we will try to put together a not-too-stupid story and then work hard to add some eye candy on top.
Speaking of coding... Arowana was right :
It works ! Here's the final commented code :
Code: Select all
init python:
# This is set to the name of the character that is speaking, or
# None if no character is currently speaking.
speaking = None
# This returns d if the character is speaking, and Null() if the
# character is not.
def while_speaking(name, d, st, at):
if speaking == name:
return d, .1
else:
return Null(), None
# Curried form of the above.
curried_while_speaking = renpy.curry(while_speaking)
# Displays d when the named character is speaking, and Null otherwise.
def WhileSpeaking(name, d):
return DynamicDisplayable(curried_while_speaking(name, d))
# This callback maintains the speaking variable.
def speaker_callback(name, event, **kwargs):
global speaking
if event == "show":
speaking = name
elif event == "slow_done":
speaking = None
elif event == "end":
speaking = None
# Curried form of the same.
speaker = renpy.curry(speaker_callback)
# END OF SPEAKING CODE
init:
# Create a speaking character.
$ roger = Character("Roger",
color = "#FF24D7", #color of the name
what_color="#FF24D7", #color of the speaking text
window_left_padding = 160, # margin of the text left
show_two_window=True, #put the name in a separate box
callback=speaker("roger"))
# Composite things together to make a character with blinking eyes and
# lip-flap.
image roger neutral = LiveComposite(
(400, 650),
(0, 0), "images/roger_neutral_corps_base.png", #base body
(170, 71), anim.Filmstrip("images/roger_neutral_eyes.png", (65, 30), (3, 7), 0.2 ),
(180, 116), WhileSpeaking("roger", anim.Filmstrip("images/roger_neutral_mouth.png", (65, 30), (4, 3), 0.1)),
(0, 0), ConditionSwitch(
"hairy == 'a beard' ", "images/roger_beard.png", #shows beard
"hairy == 'no beard' ", Null(), #shows nothing
),
)
# The game starts here.
label start:
$ hairy = "a beard" #default variable shows a bearded character
scene black with dissolve
menu:
"I love bearded guys !":
jump room01 # no change default value is a beard
"Yuck! Shave that face !":
$ hairy = "no beard" # change default value to no beard
jump room01
scene black with dissolve
show roger neutral at right with dissolve
roger "I'm neutral, and my mouth moves when I speak. I also blink. Blah blah blah blah blah blah blah."
"Not speaking anymore. -Narrator's voice"
roger "I have [hairy], depending on your previous choice. Blah blah blah blah blah blah blah."
"Good ending..."
return
Instead of the beard, I suppose you can imagine anything : clothes, hair, accessories... and make them appear by setting the corresponding variable to on or off... This is really convenient.
Note on the lip flap : at first, the mouth was too fast to even see the animation, so I added some images in the filmstrip to make it longer, and slowed the text in the options of the game (it was set on ultra-fast by default. (The lip animation plays while the text is appearing in the dialogue box, so if the text appears instantly, you don't see the mouth moving.)
I made a little jpg to better understand how this works and try to explain to my boyfriend how to create the artwork, I'll post it underneath :
@ Arowana : Thanks again for your help, I owe you one ! <3
Hope this helps some others noobs like me !