SHARE
TWEET

Ren'py Lip Flap Code

a guest Aug 17th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##lip flap #########################################
  2. ####################################################
  3. init python:
  4.     speaking = None
  5.  
  6.     def while_speaking(name, speak_d, done_d, st, at):
  7.         if speaking == name:
  8.             return speak_d, .1
  9.         else:
  10.             return done_d, None
  11.     curried_while_speaking = renpy.curry(while_speaking)
  12.  
  13.     def WhileSpeaking(name, speaking_d, done_d=Null()):
  14.         return DynamicDisplayable(curried_while_speaking(name, speaking_d, done_d))
  15.  
  16.     def speaker_callback(name, event, **kwargs):
  17.         global speaking
  18.  
  19.         if event == "show":
  20.             speaking = name
  21.         elif event == "slow_done":
  22.             speaking = None
  23.         elif event == "end":
  24.             speaking = None
  25.  
  26.             speaker = renpy.curry(speaker_callback)
  27.  
  28. ###CHARACTER###
  29.     define char = Character("Character", callback=speaker("char"))
  30.     image char = Composite(
  31.         (500,281),
  32.         (0,0), "char base.png",
  33.         (0,0), "char eyes"
  34.         (0,0), WhileSpeaking("char", "char mouth talking", "char mouth 0.png"),
  35.         )
  36.     image char mouth talking:
  37.         "char mouth 0.png"
  38.         0.2
  39.         "char mouth 1.png"
  40.         0.2
  41.         repeat
  42.     image char eyes:
  43.         "char eyes 0.png"
  44.         choice: #chooses a random wait time before playing the blink anim"
  45.             2.0
  46.         choice:
  47.             4.0
  48.         choice:
  49.             1.0
  50.     #the blink anim
  51.         "char eyes 1.png"
  52.         0.1
  53.         "char eyes 3.png" #skipping eyes2 on the way down feels more organic
  54.         0.1
  55.         "char eyes 4.png"
  56.         0.1
  57.         "char eyes 3.png"
  58.         0.1
  59.         "char eyes 2.png"
  60.         0.1
  61.         "char eyes 1.png"
  62.         0.1
  63.         "char eyes 0.png"
  64.         repeat
  65.  
  66. ####################################################
  67. ####################################################
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top