(SOLVED)Image changing height among changing x position, help?

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
Wendyd24
Regular
Posts: 39
Joined: Wed Nov 15, 2017 11:04 pm
Contact:

(SOLVED)Image changing height among changing x position, help?

#1 Post by Wendyd24 »

PSA: I have been having trouble coding recently, I've blindsided myself on a lot of issues to only later realize there was an easy fix, so if that's the case with this issue, I'm sorry and just as frustrated as you are lol.

I am having a character/sprite "transform" or be shown at the left of the screen, but unlike the rest of the characters(or so it seems), he is not keeping his size. His head normally touches the top of the screen and when I move him to the left it's about an inch below, not where he's supposed to be. This is throwing everything off, as the other characters are being moved as well (say to the right) but aren't maintaining the size difference. Ex: He's the tallest, but when he is moved to the left and his friend moved to the right, he becomes shorter than the friend.

Any help would be appreciated, and forgive me if it's something totally obvious that I'm just missing, happens a lot recently. Thanks much for reading.

Here's the code I put into a "test" game to make sure that no other instances in the script were affecting him.

Code: Select all

label start:



    scene bg room


    show elias thinking blush:
        xalign 1.00

    e "You've created a new Ren'Py game."


    return


    image elias thinking blush:
        "eliasthinkingblush"
        zoom 0.40
Last edited by Wendyd24 on Tue Jun 30, 2020 9:05 pm, edited 1 time in total.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Image changing height among changing x position, help?

#2 Post by isobellesophia »

Maybe you can try this?

Code: Select all

label start:
    scene bg room 
    show elias thinking blush: 
    xalign 0.0 
    e "You've created a new Ren'Py game." 
    
Im not sure about the zoom, are you trying to zoom in your character or just move left to right?
I am a friendly user, please respect and have a good day.


Image

Image


Wendyd24
Regular
Posts: 39
Joined: Wed Nov 15, 2017 11:04 pm
Contact:

Re: Image changing height among changing x position, help?

#3 Post by Wendyd24 »

The zoom is part of the sprite size, that I've adjusted in-game. I like to do this and have characters have sprites that are closer or farther away from the camera without junking up my images with lots of different sprites.


image elias happy close:
"eliashappy"
zoom 0.60

But with this sprite, he doesn't seem to be keeping his zoom size while moving to the left.
xalign 1.00 is where I want him on the screen, while also keeping the zoom that's defined in his image. I'm trying to both move him left and keep him zoomed.

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Image changing height among changing x position, help?

#4 Post by Alex »

Wendyd24 wrote: Mon Jun 29, 2020 10:44 am The zoom is part of the sprite size, that I've adjusted in-game. ...
You can't redefine your image midgame - Ren'Py searches for all image declarations and run them before the game starts.


You could either apply zoom property to the image directly when you show it, or made a set of transforms with different zoom properties and show your images using those transforms.

Try it like

Code: Select all

transform zoom_100:
    linear 0.5 zoom 1.0
transform zoom_60:
    linear 0.5 zoom 0.6
transform zoom_40:
    linear 0.5 zoom 0.4

label start:
    show eileen at center
    "..."
    show eileen at left:
        zoom 0.6

    "... ..."
    show eileen at left, zoom_100
    $ renpy.pause(1.0)
    show eileen at center, zoom_60
    with move
    $ renpy.pause(0.5)
    show eileen at center, zoom_40
    with move
    "?!"
https://www.renpy.org/doc/html/atl.html

Wendyd24
Regular
Posts: 39
Joined: Wed Nov 15, 2017 11:04 pm
Contact:

Re: Image changing height among changing x position, help?

#5 Post by Wendyd24 »

I suppose I've misspoken. I am not redefining the image size "midgame" or ingame, as I said, but rather in the program. I define the characters and their sizes in a separate script file called image definitions.

Again, for example in the separate renpy rpy file where I define all the character's images, there would be this below.

image elias thinking blush:
"eliasthinkingblush"
zoom 0.40

I will be using this character a lot with other characters on the screen, so I'd like to be able to show him at other positions without having to declare zoom every time he's stated to be shown with another character.

Thanks for the reply, I'm not sure it'll fix it, but I'll try to read up on/test out some transitions.

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Image changing height among changing x position, help?

#6 Post by Alex »

Wendyd24 wrote: Mon Jun 29, 2020 10:46 pm ...I will be using this character a lot with other characters on the screen, so I'd like to be able to show him at other positions without having to declare zoom every time he's stated to be shown with another character. ...
Hm, correct me if don't get it right (again):
- if you've declared 'elias thinking blush' image (that is zoomed "eliasthinkingblush"), you'll be able to use it everywhere, and it will always be 40% zoomed "eliasthinkingblush".
- if you need "eliasthinkingblush" image zoomed in and out in your game, try either declare different images with different zoom property, or set some transforms that set different zoom values and apply them to "eliasthinkingblush" image.

strayerror
Regular
Posts: 159
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Image changing height among changing x position, help?

#7 Post by strayerror »

It's not easy to fully grasp the problem you're having based on the initial description. Consider providing an example using _placeholder/girl.png and/or _placeholder/boy.png images (they're built into Ren'Py so the example could be run by anyone), and if necessary a screenshot or two of the problem (using the example if possible so others can compare what they see to what you're pointing to as the problem).

-----

With that said, here's my interpretation of the problem you're facing, I hope it's focused on the right problem and can be of use! Good luck!
Wendyd24 wrote: Sat Jun 27, 2020 11:21 pmHis head normally touches the top of the screen and when I move him to the left it's about an inch below, not where he's supposed to be.
By default displayables are align (0.5, 1.0) meaning that they are position in the middle of the screen horizontally, with their bottom edge touching the bottom of the game window. As soon as you alter a positioning property (align, pos, anchor - or any of their x/y variants) this default is forgotten and any unset value becomes 0.

This means that as soon as you set xalign 1.00 in your show statement, the sprite position moves from horizontally centred with it's bottom edge touching the bottom of the game window, to having it's top and right edges touching the top and right edges of the game window respectively. So the extra space you're seeing above the characters head is likely due to transparent pixels in your sprite as the top-right corner of your sprite image will now match the top-right corner of your game window.

If this is not what you intend then either be explicit about how the displayable should be positioned vertically, or consider removing the transparent space over your sprite's head.

Wendyd24
Regular
Posts: 39
Joined: Wed Nov 15, 2017 11:04 pm
Contact:

Re: Image changing height among changing x position, help?

#8 Post by Wendyd24 »

Hm, correct me if don't get it right (again):
- if you've declared 'elias thinking blush' image (that is zoomed "eliasthinkingblush"), you'll be able to use it everywhere, and it will always be 40% zoomed "eliasthinkingblush".
- if you need "eliasthinkingblush" image zoomed in and out in your game, try either declare different images with different zoom property, or set some transforms that set different zoom values and apply them to "eliasthinkingblush" image.
Thanks for the second response. c:

I found a fix based on your recommendation and also declared different images with different zoom properties so that I wouldn't have another issue like this.

Thanks for the help <3 Marking the topic as solved

Post Reply

Who is online

Users browsing this forum: apocolocyntose, Majestic-12 [Bot], Semrush [Bot]