help
init python:
class DynamicBlink(renpy.display.layout.DynamicDisplayable):
def __init__(self, images, closing_pause=0.15,opening_pause=0.1,**kwargs):
self.closing = True
self.used_images = images
self.current_image_index = 0
self.image_count = len(images) - 1
# first image have to be opened eyes
self.current_image = images[0]
# Force normal timer start value
self.blink_timer = -1.0
self.closing_pause = closing_pause
self.opening_pause = opening_pause
kwargs.update( {
'_predict_function' : self.predict_images } )
super(DynamicBlink, self).__init__( self.get_current_blink_image )
def get_current_blink_image(self, timer, at):
if self.closing == True:
if timer > self.blink_timer:
self.current_image_index += 1
self.current_image = self.used_images[self.current_image_index]
self.blink_timer = timer + self.closing_pause
if self.current_image_index == self.image_count:
self.closing = False
self.blink_timer = timer + 0.1
else:
if timer > self.blink_timer:
self.current_image_index -= 1
self.current_image = self.used_images[self.current_image_index]
self.blink_timer = timer + self.opening_pause
if self.current_image_index == 0:
self.closing = True
# Define the time between two blink with some random to make it more real
self.blink_timer = timer + 2.0 + ( renpy.python.rng.random() * 3.0 )
return self.current_image, 0
def predict_images(self):
return self.used_images image dynamic_blinking = DynamicBlink(["belle.png", "belle1.png", "belle2.png", "belle3.png", "belle4.png", "belle5.png"],
closing_pause=0.065, opening_pause=0.065 )
I can't handle this function how can I integrate it into renpy and how can I use it would like to make the conversation between two people more dynamic