Trouble with "Show image at xpos"

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
arglefumph
Newbie
Posts: 3
Joined: Sat Dec 16, 2017 12:17 pm
Contact:

Trouble with "Show image at xpos"

#1 Post by arglefumph »

For some reason, I can't get the xpos/ypos feature to be consistent. If I show an image like this...

show character at Position(xpos=50,ypos=50)

And I show the same image, as an imagebutton...

imagebutton:
idle "character.png"
xpos 50 ypos 50

They don't match up. The two images appear in different places! I don't understand why, since they're at the same coordinates. What's going on? Am I showing images incorrectly, or something?

I tried checking the documentation (https://www.renpy.org/doc/html/displayi ... -statement), but all it says about "show at" is "The at property takes one or more comma-separated simple expressions." I have no idea what that means. The only example they give for "show at" is "show image at right", which doesn't help, either.

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

Re: Trouble with "Show image at xpos"

#2 Post by Alex »

Try to set padding property for a button - https://www.renpy.org/doc/html/style_pr ... ty-padding

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

Re: Trouble with "Show image at xpos"

#3 Post by strayerror »

I believe Position is considered deprecated these days, try using Transform instead which should match your imagebutton much better.

arglefumph
Newbie
Posts: 3
Joined: Sat Dec 16, 2017 12:17 pm
Contact:

Re: Trouble with "Show image at xpos"

#4 Post by arglefumph »

Thanks! I can try looking into padding and transform. Any chance you can give an example of what the code might look like, if I use those features? Would it be something like Transform(image,xpos=50,ypos=50) or imagebutton.padding xpos 50 ypos 50?

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Trouble with "Show image at xpos"

#5 Post by Imperf3kt »

You're using the image button inside a screen, right?
Are you able to share the screen code and we can see what maybe worth looking at regarding padding / margins.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

arglefumph
Newbie
Posts: 3
Joined: Sat Dec 16, 2017 12:17 pm
Contact:

Re: Trouble with "Show image at xpos"

#6 Post by arglefumph »

Sure, I can share the code. First is the character as an imagebutton on a screen. The player clicks on the character and is taken to a scene, where the character talks. I had to change the xpos and ypos values, so the character appears in the same spot, both times. If you use the same same xpos and ypos values for both, the character moves to the left.


screen puzzle_3_solve_7:
imagemap:
ground "images/scenes/3/background.png"

imagebutton:
idle "character.png"
xpos 1050 ypos 331
action [Jump("puzzle_3_solve_8")]

label puzzle_3_solve_8:
scene background
show character at Position(xpos=1076,ypos=460)
character "I am saying something."

Post Reply

Who is online

Users browsing this forum: CalixtheGreat, Google [Bot], henne