Character Sprite Stops Scaling After Changing Position

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
Draite
Regular
Posts: 26
Joined: Tue Oct 08, 2019 9:10 pm
Contact:

Character Sprite Stops Scaling After Changing Position

#1 Post by Draite »

I'm very confused about how attributes are being applied to sprites. I have a couple of custom attributes set up so that I can scale a sprite down slightly and also tint them. These seems to work as is, though I'm sure they can be improved upon drastically.

Code: Select all

# Set sprite size to 50%
transform downscale:
    zoom 0.5

# Fade the sprite for when a character isn't talking
transform faded:
    matrixcolor BrightnessMatrix(0.0)
    linear 0.5 matrixcolor BrightnessMatrix(-0.1)

# Undo sprite fading
transform unfade:
    matrixcolor BrightnessMatrix(-0.1)
    linear 0.5 matrixcolor BrightnessMatrix(0.0)
The issue I'm running into is when they're applied, the scaling gets messy and I can't figure out why or what is causing it.

When I have the follow script

Code: Select all

"Some text"

show character neutral at midright, downscale, faded with dissolve

"Some more text"

show character sad at top, unfade

"Some more text"

show xviii depressed at faded

"Some final text"
Character remains scaled to 50% for the first 4 lines, but on line 5 returns to full scale. I think the cause is something to do with the change of position, but I don't understand why or what the solution is. I also can't just add downscale to every line because that causes the scaling to stack, setting them to 1/4 scale at the second line. Does anyone know why this happens or have a better solution for scaling and manipulating sprites?

User avatar
Johan
Regular
Posts: 76
Joined: Mon Jan 14, 2019 5:58 pm
Organization: DMEOW
itch: dmeow
Location: Perú
Discord: Johan#7444
Contact:

Re: Character Sprite Stops Scaling After Changing Position

#2 Post by Johan »

I'm... not sure why it does that BUT!

If you want the character to be at zoom 0.5 during the whole game, it would be better if you use LayeredImages. You can apply Transform there too, like zoom. That would make the sprite at zoom 0.5 by default without having to declare it every time you show the character.

Now, if you only want the character to be at zoom 0.5 at certain points, you can simply use Transform(zoom=0.5) instead. Like this:

Code: Select all

show character neutral at midright, faded, Transform(zoom=0.5) with dissolve
That way, the scaling won't stack every time you use it.

Btw, I'm curious about why did you define Fade as a transform? ^^;;
You can define your own kind of Fade as a transition. Not that it's bad thing to define it as a Transform, I think? xD

I'm not that pro in programming but I hope I could be of help! 😄😄
dmeow !
Check my silly blog!

◤ And I saw the stars ★ falling down... ◢
Check the game!! IT'S OUT!!!
.

Draite
Regular
Posts: 26
Joined: Tue Oct 08, 2019 9:10 pm
Contact:

Re: Character Sprite Stops Scaling After Changing Position

#3 Post by Draite »

Thanks for the suggestions, I'll look into the LayeredImages thing and see if that work.

I set it as a Transform because it's not a transition. It's just making the character slightly less bright to help clarify who is talking/taking priority. Unless I can use a fade transition to manipulate single sprite.

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Character Sprite Stops Scaling After Changing Position

#4 Post by PyTom »

I'm not able to repeat this one, using:

Code: Select all

define _confirm_quit = False

define e = Character("Eileen", image="eileen")
define l = Character("Lucy", image="lucy")
define a = Character("Augustina", image="augustina")

label main_menu:
    return


transform midright:
    xcenter .66 yalign 1.0

transform top:
    xalign 0.5 yalign 0.0

# Set sprite size to 50%
transform downscale:
    zoom 0.5

# Fade the sprite for when a character isn't talking
transform faded:
    matrixcolor BrightnessMatrix(0.0)
    linear 0.5 matrixcolor BrightnessMatrix(-0.1)

# Undo sprite fading
transform unfade:
    matrixcolor BrightnessMatrix(-0.1)
    linear 0.5 matrixcolor BrightnessMatrix(0.0)

label start:
    scene bg washington

    "Some text"

    show character neutral at midright, downscale, faded with dissolve

    "Some more text"

    show character sad at top, unfade

    "Some more text"

    show xviii depressed at faded

    "Some final text"
As the script of a new game. At least for me, the character stays the same size as she moves around, and then a second image is shown.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]