Characters with image tags go to wrong location when skipping

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
qirien
Veteran
Posts: 464
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Contact:

Characters with image tags go to wrong location when skipping

#1 Post by qirien » Wed Sep 12, 2018 3:06 pm

Hey, I am noticing some strange behavior with character images when using image tags to change expressions. Everything works fine unless transitions are disabled (either from the preferences, or if someone is skipping text). Without transitions, sprites with image tags end up in the center instead of where they're supposed to be (this does not appear to happen to sprites without image tags). I believe I've narrowed it down to something that only happens if you show an image with one tag, and then say dialogue in the next statement with a different image tag. It also only happens with my custom midright/midleft positions; it does not happen with the builtin left and right positions.

Here is a simple example (you don't actually need the images to see the behavior):

Code: Select all

define her = Character("Kelly", image="her")
define him = Character("Jack", image="him")

define midright = Position(xpos=0.65, xanchor=0.5)
define midleft = Position(xpos=0.35, xanchor=0.5)

label start:
    scene black with fade
    show her normal at midright
    show him happy at midleft

    him annoyed "I was supposed to go to midleft... not center!"
    return
If you run this code with transitions ON, everything works fine. However, with transitions OFF, "him" shows up at the center of the screen instead of at midleft.

Am I using these statements correctly, or is there a bug?
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

philat
Eileen-Class Veteran
Posts: 1622
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Characters with image tags go to wrong location when skipping

#2 Post by philat » Wed Sep 12, 2018 8:31 pm

Position() is pretty outdated. Have you tried using a transform instead?

User avatar
qirien
Veteran
Posts: 464
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Contact:

Re: Characters with image tags go to wrong location when skipping

#3 Post by qirien » Wed Sep 19, 2018 2:54 pm

Really? The documentation doesn't say it's deprecated or anything... but perhaps it's meant more for screen elements than for sprites. Using transforms instead of positions did indeed fix the problem, like this:

Code: Select all

transform midleft:
    xpos 0.35 xanchor 0.0 ypos 1.0 yanchor 1.0

transform midright:
    xpos 0.65 xanchor 0.0 ypos 1.0 yanchor 1.0
Thanks for your help philat!
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

Post Reply

Who is online

Users browsing this forum: rayminator, xavimat