I recently experimented with character transition using TransitionConditionSwitch (viewtopic.php?f=51&t=26612#p326683) and character tinting when the character isn't speaking (viewtopic.php?f=8&t=34286).
But when my friend and I tested it in PC and Android device, we noticed a "hiccup" in character transition. There are a few times where character seems skipping the dissolve animation when showing up on the screen.
A snippet for the TransitionConditionSwitch I use in my script (as far as I remember, I didn't change anything from the one written in the post about this condition switch):
Code: Select all
####### Transition Condition Switch Experiment #######
init python:
class TransitionConditionSwitch(renpy.Displayable):
def __init__(self, transition, *args, **kwargs):
super(TransitionConditionSwitch, self).__init__(**kwargs)
self.transition = transition
self.d = zip(args[0::2], args[1::2])
self.time_reset = True
self.old_d = None
self.current_d = None
self.ta = None
def render(self, width, height, st, at):
if self.time_reset:
self.time_reset = False
self.st = st
self.at = at
return renpy.render(self.ta, width, height, st-self.st, at-self.at)
def per_interact(self):
for name, d in self.d:
if eval(name):
change_to = d
break
if change_to is not self.current_d:
self.time_reset = True
self.old_d = self.current_d
self.current_d = change_to
if self.old_d is None:
self.old_d = self.current_d
self.ta = anim.TransitionAnimation(self.old_d, 0.00, self.transition, self.current_d)
renpy.redraw(self, 0)
def visit(self):
return [self.ta]
Code: Select all
define mei = Character('Mei', color="#ffffff")
define mei_expression = "default"
##### Tinted Images
image meitint default = im.MatrixColor("images/characters/mei/default/mei default.png", im.matrix.brightness(-0.3))
image meitint default2 = im.MatrixColor("images/characters/mei/default/mei default2.png", im.matrix.brightness(-0.3))
image meitint smile = im.MatrixColor("images/characters/mei/default/mei smile.png", im.matrix.brightness(-0.3))
image meitint frown = im.MatrixColor("images/characters/mei/default/mei frown.png", im.matrix.brightness(-0.3))
image meitint surprised = im.MatrixColor("images/characters/mei/default/mei surprised.png", im.matrix.brightness(-0.3))
image meitint frown2 = im.MatrixColor("images/characters/mei/default/mei frown2.png", im.matrix.brightness(-0.3))
image meitint angry = im.MatrixColor("images/characters/mei/default/mei angry.png", im.matrix.brightness(-0.3))
image meitint sad = im.MatrixColor("images/characters/mei/default/mei sad.png", im.matrix.brightness(-0.3))
image meitint cocky = im.MatrixColor("images/characters/mei/default/mei cocky.png", im.matrix.brightness(-0.3))
##### Default
image mei default = TransitionConditionSwitch(Dissolve(0.3, alpha=True),
# when speaking
"mei_expression == 'default' and _last_say_who == 'mei'", "images/characters/mei/default/mei default.png",
"mei_expression == 'default2' and _last_say_who == 'mei'", "images/characters/mei/default/mei default2.png",
"mei_expression == 'smile' and _last_say_who == 'mei'", "images/characters/mei/default/mei smile.png",
"mei_expression == 'frown' and _last_say_who == 'mei'", "images/characters/mei/default/mei frown.png",
"mei_expression == 'surprised' and _last_say_who == 'mei'", "images/characters/mei/default/mei surprised.png",
"mei_expression == 'frown2' and _last_say_who == 'mei'", "images/characters/mei/default/mei frown2.png",
"mei_expression == 'angry' and _last_say_who == 'mei'", "images/characters/mei/default/mei angry.png",
"mei_expression == 'sad' and _last_say_who == 'mei'", "images/characters/mei/default/mei sad.png",
"mei_expression == 'cocky' and _last_say_who == 'mei'", "images/characters/mei/default/mei cocky.png",
# when not speaking
"mei_expression == 'default' and not _last_say_who == 'mei'", "meitint default",
"mei_expression == 'default2' and not _last_say_who == 'mei'", "meitint default2",
"mei_expression == 'smile' and not _last_say_who == 'mei'", "meitint smile",
"mei_expression == 'frown' and not _last_say_who == 'mei'", "meitint frown",
"mei_expression == 'surprised' and not _last_say_who == 'mei'", "meitint surprised",
"mei_expression == 'frown2' and not _last_say_who == 'mei'", "meitint frown2",
"mei_expression == 'angry' and not _last_say_who == 'mei'", "meitint angry",
"mei_expression == 'sad' and not _last_say_who == 'mei'", "meitint sad",
"mei_expression == 'cocky' and not _last_say_who == 'mei'", "meitint cocky"
)
Also, I use im.MatrixColor to do the tinting.
I'm using renPy 6.99.12.4.
- Is this issue caused by too many processing I put when showing character sprite?
- If it should be okay to have this many processing, I'd be grateful if someone could point out what's wrong in which part
(I'm not new with programming, but isn't really familiar with renPy in depth. Plus, I kinda have hard times determining what's the suitable keyword to put into Google search because English isn't my native language.)
Thanks in advance!
TL;DR version: my character transition is hiccup-ed, I probably made a mess by combining TransitionConditionSwitch and tinting character that's not talking; please help me. orz