How to make a character zoom in a bit when talking, just like in DDLC
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
- Newbie
- Posts: 11
- Joined: Thu Jul 28, 2022 12:03 am
- Contact:
How to make a character zoom in a bit when talking, just like in DDLC
I need the character to have a little zoom animation when talking, just like in the game doki doki literature club
Re: How to make a character zoom in a bit when talking, just like in DDLC
Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
-
- Newbie
- Posts: 11
- Joined: Thu Jul 28, 2022 12:03 am
- Contact:
Re: How to make a character zoom in a bit when talking, just like in DDLC
It's confusing, and it's in Russian
Re: How to make a character zoom in a bit when talking, just like in DDLC
Code: Select all
init python:
# automatic declaration of sprites
config.automatic_images_minimum_components = 1
config.automatic_images = [" ", "_", "/"]
config.automatic_images_strip = ["images"]
init:
# brightness and scale of selected character
default char_brightness = .15
default char_zoom = 1.025
# time to select a character
default char_t = .25
# the position of the sprite on the screen
transform xpos(x=.5):
anchor(.5, 1.)
pos(x, 1.)
# smoothly turn off character selection
transform mark_off(t=char_t):
ease_quad t matrixcolor BrightnessMatrix(0) zoom 1
# smoothly turn on character selection
transform mark(t=char_t, z=char_zoom):
parallel:
matrixcolor BrightnessMatrix(0)
# for flash
ease_quad t*.25 matrixcolor BrightnessMatrix(char_brightness * 2)
# for permanent selection
ease_quad t*.75 matrixcolor BrightnessMatrix(char_brightness)
parallel:
# increase - move to the front
ease_quad t zoom z
init python:
from functools import partial
# find an image on the screen that starts with the given tag
# (so that the selection does not take into account emotions and other additional tags)
def img_by_tag(tag):
if tag:
imgs = renpy.get_showing_tags()
for i in imgs:
if str(i).startswith(tag):
return str(i)
# if there is no talking character on the screen, then we do not show it
return None
# last speaker
speaking_char = None
# show the same character if it's already on the screen
def char_show(char, at_list=[]):
i = img_by_tag(char)
if i:
renpy.show(i, at_list=at_list)
# remove selection
def char_off(t=None):
# if you need to wait, then take the pause set in the settings
if t == True:
t = char_t
# deselect
char_show(img_by_tag(store.speaking_char), at_list=[mark_off()])
store.speaking_char = None
# pause if necessary so that the character has time to deselect
if t:
renpy.pause(t)
# highlight the speaker
def char_blink(char, event_name, *args, **kwarg):
# if a new character starts talking
if event_name == "begin" and char != store.speaking_char:
# then deselect the old one
char_off()
# remember the new speaker
store.speaking_char = char
# put a selection on it
char_show(char, at_list=[mark()])
# reduce writing when declaring characters
# function with parameters as one parameter
def c_b(*args, **kwarg):
return partial(char_blink, *args, **kwarg)
# replacing the usual Character with a new one, where the second parameter is a sprite
def CH(name=None, sprite=None, *args, **kwarg):
return Character(name, callback=c_b(sprite), *args, **kwarg)
# narrator deselects last character due to sprite=None
narrator = CH()
# the second parameter is the first tag of the sprite associated with the character
g = CH(_("Girl"), "girl", color="#f88")
# other parameters can be the same as in a regular Character
b = CH(_("Boy"), "boy")
# if you do not specify a sprite, then the character will simply deselect the last speaker
v = CH(_("Inner voice"), color="#f88")
label start:
scene bg street
with dissolve
# show characters
show boy ok at xpos(.33)
show girl ok at xpos(.66)
with dissolve
pause .5
# start a stupid dialogue
g "Hi."
b "Darof!"
"*glow fades*"
show boy wat
b "Did you see? I just got jocked and sparks came out of my eyes. I glowed like a light bulb in a refrigerator."
Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: How to make a character zoom in a bit when talking, just like in DDLC
A simpler, though less versatile, way might be to pass the relevant image tag into an ATL and then use that within a transform function that grows/shrinks based on speaking character...
Code: Select all
init python:
def pop_character(trans, st, at, tag=None):
## Check get_say_image_tag() and adjust up if tag matches else down
adjust = 0.005 if tag == renpy.get_say_image_tag() else -0.005
## The 1.1 here is the max zoom, adjust as needed
trans.zoom = min(1.1, max(1.0, trans.zoom + adjust))
return 0.0
transform pop_char(tag=None):
## we pass the tag directly into the repeating function above
function renpy.curry(pop_character)(tag=tag)
### Example images just using coloured blocks
image eileen = Solid("#F00", xysize=(200, 400))
image eileen happy = Solid("#F44", xysize=(200, 400))
image lucy = Solid("#F4F", xysize=(200, 400))
define e = Character("Eileen", image="eileen")
define l = Character("Lucy", image="lucy")
label start:
## at transform (with specified tag reference) and positional data in block
show eileen at pop_char("eileen"):
anchor (0.5, 1.0)
pos (150, 1.0)
show lucy at pop_char("lucy"):
anchor (0.5, 1.0)
pos (650, 1.0)
# get_say_image_tag is None
"Neither"
# Now get_say_image_tag is "eileen"
# eileen image now zooming larger
e "Me"
# get_say_image_tag now "lucy"
# lucy image now zooming larger AND eileen shrinking
l "Me"
# still works when showing "eileen happy" as the "eileen" tag is present
e happy "Me"
l "Me"
pause
return
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: decocloud