Having side image position change depending on the character
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.
Having side image position change depending on the character
I have two characters with side images. I want character A's image to be aligned to the left while character B is aligned to the right. How do I do that?
In the old wiki code, I can declare the xalign in the character declare code, but now that the side image system changed, it doesn't work anymore.
In the old wiki code, I can declare the xalign in the character declare code, but now that the side image system changed, it doesn't work anymore.
Re: Having side image position change depending on the chara
You need to modify say screen a bit - add a variable for side image position, then you'll be able to set its value for different characters, like
(while character declaration, custom variables must be prefixed with extra "show_" in their names).
Code: Select all
screen say:
# Defaults for side_image and two_window
default side_image = None
default two_window = False
default side_xalign = 0.0 # default values, so you don't need to change all the characters
default side_yalign = 1.0
# Decide if we want to use the one-window or two-window variant.
if not two_window:
# The one window variant.
window:
id "window"
has vbox:
style "say_vbox"
if who:
text who id "who"
text what id "what"
else:
# The two window variant.
vbox:
style "say_two_window_vbox"
if who:
window:
style "say_who_window"
text who:
id "who"
window:
id "window"
has vbox:
style "say_vbox"
text what id "what"
# If there's a side image, display it above the text.
if side_image:
add side_image
else:
add SideImage() xalign side_xalign yalign side_yalign #xalign 0.0 yalign 1.0
# Use the quick menu.
use quick_menu
Code: Select all
# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8", image="eileen", show_side_xalign=1.0)
image side eileen = "eileen_side.png"
# The game starts here.
label start:
e "You've created a new Ren'Py game."
e "Once you add a story, pictures, and music, you can release it to the world!"
-
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: Having side image position change depending on the chara
Another way to do this is:
Code: Select all
define eLeft = Character('Eileen', color="#c8ffc8", show_side_image = Image("e.png", xalign = 0.0, yalign = 1.0) )
define eRight = Character('Eileen', color="#c8ffc8", show_side_image = Image("e.png", xalign = 1.0, yalign = 1.0) )
Re: Having side image position change depending on the chara
Alex wrote:You need to modify say screen a bit - add a variable for side image position, then you'll be able to set its value for different characters, likeCode: Select all
screen say: # Defaults for side_image and two_window default side_image = None default two_window = False default side_xalign = 0.0 # default values, so you don't need to change all the characters default side_yalign = 1.0 # Decide if we want to use the one-window or two-window variant. if not two_window: # The one window variant. window: id "window" has vbox: style "say_vbox" if who: text who id "who" text what id "what" else: # The two window variant. vbox: style "say_two_window_vbox" if who: window: style "say_who_window" text who: id "who" window: id "window" has vbox: style "say_vbox" text what id "what" # If there's a side image, display it above the text. if side_image: add side_image else: add SideImage() xalign side_xalign yalign side_yalign #xalign 0.0 yalign 1.0 # Use the quick menu. use quick_menu
(while character declaration, custom variables must be prefixed with extra "show_" in their names).Code: Select all
# Declare characters used by this game. define e = Character('Eileen', color="#c8ffc8", image="eileen", show_side_xalign=1.0) image side eileen = "eileen_side.png" # The game starts here. label start: e "You've created a new Ren'Py game." e "Once you add a story, pictures, and music, you can release it to the world!"
Thanks, Alex!!
That is the old code that I said don't work too well for what I need.DragoonHP wrote:Another way to do this is:
Code: Select all
define eLeft = Character('Eileen', color="#c8ffc8", show_side_image = Image("e.png", xalign = 0.0, yalign = 1.0) ) define eRight = Character('Eileen', color="#c8ffc8", show_side_image = Image("e.png", xalign = 1.0, yalign = 1.0) )
- balldancing
- Regular
- Posts: 65
- Joined: Tue Sep 03, 2013 9:32 am
- Location: milan
- Contact:
Re: Having side image position change depending on the chara
hi there!! this is perfect~ just one problem :s after adding this, i lost my namebox and show_two_window=True isn't working anymore. any ideas?Alex wrote:You need to modify say screen a bit - add a variable for side image position, then you'll be able to set its value for different characters, likeCode: Select all
screen say: # Defaults for side_image and two_window default side_image = None default two_window = False default side_xalign = 0.0 # default values, so you don't need to change all the characters default side_yalign = 1.0 # Decide if we want to use the one-window or two-window variant. if not two_window: # The one window variant. window: id "window" has vbox: style "say_vbox" if who: text who id "who" text what id "what" else: # The two window variant. vbox: style "say_two_window_vbox" if who: window: style "say_who_window" text who: id "who" window: id "window" has vbox: style "say_vbox" text what id "what" # If there's a side image, display it above the text. if side_image: add side_image else: add SideImage() xalign side_xalign yalign side_yalign #xalign 0.0 yalign 1.0 # Use the quick menu. use quick_menu
(while character declaration, custom variables must be prefixed with extra "show_" in their names).Code: Select all
# Declare characters used by this game. define e = Character('Eileen', color="#c8ffc8", image="eileen", show_side_xalign=1.0) image side eileen = "eileen_side.png" # The game starts here. label start: e "You've created a new Ren'Py game." e "Once you add a story, pictures, and music, you can release it to the world!"
Re: Having side image position change depending on the chara
That's strange, 'cause this script working fine for me
Code: Select all
# Declare characters used by this game.
define narrator = Character(" ", show_two_window=True) # if you need the namebox for narrator too
define e = Character('Eileen', color="#c8ffc8", image="eileen", show_side_xalign=1.0, show_two_window=True)
- minyan
- Miko-Class Veteran
- Posts: 630
- Joined: Tue Feb 10, 2015 3:59 pm
- Completed: Trial By Fire, Heartbaked, Ellaria, Plain, This My Soul, The Pretenders Guild
- Projects: Arena Circus
- Tumblr: minyanstudios
- itch: harlevin
- Contact:
Re: Having side image position change depending on the character
Are there any recent updates on this code? None of these options are working for me.
Who is online
Users browsing this forum: Ahrefs [Bot]