position png images

Questions, skill improvement, and respectful critique involving game writing.
Post Reply
Message
Author
Gianserpe
Newbie
Posts: 21
Joined: Mon May 27, 2019 4:20 pm
Contact:

position png images

#1 Post by Gianserpe »

Hi and sorry for my bad english. I just started using renpy and I had a question about images. I wanted to place png images in specific areas of the scenario by setting the area where they should be, for example (300,350,768,169). Forgive me for the stupid and banal question, but I hope you can help me.

Mutive
Veteran
Posts: 344
Joined: Tue Nov 21, 2017 2:23 am
Completed: Eidolon, Minion!, Love Furever, Epilogue
Contact:

Re: position png images

#2 Post by Mutive »

https://www.renpy.org/doc/html/displaying_images.html gives some good information as to how to position images.

To place the image where you want, you do something along the lines of:

Code: Select all

show image.png:
		xalign 0.5 yalign 0.5
(You'll need to change the xalign and yalign coordinates to where you want the image.)

You can also do other fancy stuff like shrink the image, rotate it, have it zoom in or out, etc.
Enjoy Eidolon, my free to play game at: https://mutive.itch.io/eidolon, Minion! at: https://mutive.itch.io/minion or Epilogue at: https://mutive.itch.io/epilogue

Gianserpe
Newbie
Posts: 21
Joined: Mon May 27, 2019 4:20 pm
Contact:

Re: position png images

#3 Post by Gianserpe »

Thank you very much for your reply. I also wanted to know if there was a way to understand the xalign and yalign coordinates of a point. Pressing Shift + O opens the developer tool and by selecting an image I can see (x, y, length and height) of it. I wanted to know if instead of (x, y, length, height) I could know the xalign and yalign coordinates. Thank you very much for your help, you are really kind and helpful 😊.

Mutive
Veteran
Posts: 344
Joined: Tue Nov 21, 2017 2:23 am
Completed: Eidolon, Minion!, Love Furever, Epilogue
Contact:

Re: position png images

#4 Post by Mutive »

I'm not sure (I haven't worked with the developer tool, so know essentially nothing about it!).

xalign and yalign, though, refer to a relative position vs. an absolute position (e.g. how far off from center the image is vs. which pixel it's on). There's almost certainly a way to translate from one to the other, but I'm not sure how complicated it would be to do. (The Cookbook might mention this somewhere.)
Enjoy Eidolon, my free to play game at: https://mutive.itch.io/eidolon, Minion! at: https://mutive.itch.io/minion or Epilogue at: https://mutive.itch.io/epilogue

Gianserpe
Newbie
Posts: 21
Joined: Mon May 27, 2019 4:20 pm
Contact:

Re: position png images

#5 Post by Gianserpe »

Thank you very much for the time and patience, I'll look in the cookbook 😊

Post Reply

Who is online

Users browsing this forum: No registered users