character images overlap by default (?)

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
Mikan
Veteran
Posts: 364
Joined: Sun Dec 23, 2007 12:20 am
Contact:

character images overlap by default (?)

#1 Post by Mikan »

hahaha no, no help.
Last edited by Mikan on Sat Oct 16, 2010 6:08 pm, edited 1 time in total.

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: character images overlap by default (?)

#2 Post by Jake »

Mikan wrote:Heya Ren'py community.
My character images are overlapping, and I don't know how to prevent this.
The problem is different depending on what you actually want to happen.

Basically, Ren'Py kind of groups images by their 'tag', which is the first whole word of the name you give them. And when you display a new image, if there's one already displayed with the same tag, it'll remove that one before displaying your new image. So if you have several sprites for the same character, it's best to give them names which all consist of the same tag, followed by a space, followed by a more descriptive name, e.g.:

Code: Select all

image girl happy = "happygirl.png"
image girl sad = "sad.png"
image girl neutral = "standing.png"
- so all of these have the same tag - the 'girl' part - but different descriptions, so when you do:

Code: Select all

show girl happy at left
girl "I'm happy!"
show girl sad at left
girl "Now I'm sad!"
then when Ren'Py gets to "show girl sad at left", it knows you're already showing 'girl', removes the 'girl happy' sprite, then displays the 'girl sad' sprite all at the same time, so it looks like your girl is changing expression from happy to sad.

If you have several sprites for the same character which don't have the same tag, then you'll have to hide the previous one before displaying the new one, e.g.

Code: Select all

show happy girl at left
girl "I'm happy!"
hide happy girl
show sad girl at left
girl "Now I'm sad!"
...but of course, it's usually a far better idea to just rename your images so that Ren'Py can deal with all of that for you.




On the other hand, if your problem is simply that you're trying to show several different characters and they're all stacking up on top of each other, then the solution is to change the 'at left' at the end of the show statements to something else. "at right" or "at center" might be good places to start. ;-)
Server error: user 'Jake' not found

Mikan
Veteran
Posts: 364
Joined: Sun Dec 23, 2007 12:20 am
Contact:

Re: character images overlap by default (?)

#3 Post by Mikan »

Wow... so I guess I should stick on a "Hide" comment after every image?

Good thing there's a replace function in the editor.

In the above dialog, different characters are taking turns talking.
When one character is done talking, the next character shows up, and so forth...

oh, and:
I'd also like to make it so that there's a margin on the left and right of the game so that the images wern't so close to the edges, but I'm not sure how to do this either.

000
Regular
Posts: 94
Joined: Mon Dec 24, 2007 11:09 am
Projects: Ren'Py Russian distributive
Location: Уфа, РБ, Россия
Contact:

Re: character images overlap by default (?)

#4 Post by 000 »

Mikan wrote:In the above dialog, different characters are taking turns talking.
When one character is done talking, the next character shows up, and so forth...
Hm, maybe you would want to show different characters on different locations? Not only 'at left', but 'at center' or even 'at right'? Else you have to hide one character and then show another on his/hers place.
I'd also like to make it so that there's a margin on the left and right of the game so that the images wern't so close to the edges, but I'm not sure how to do this either.
Maybe just leave some space is char sprites? Only way without it I could come up is redifining positions...
But still, I am also newbie.
<feels sowwy for his Engrish>

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: character images overlap by default (?)

#5 Post by JQuartz »

000 wrote:Maybe just leave some space is char sprites? Only way without it I could come up is redifining positions...
Yeah I think that your options.
To redefine positions put the new coordinates like so:

Code: Select all

init:
    $ JQuartz_right= Position(xpos=0.2,ypos=0.5,xanchor=0,yanchor=0)
And use it like so:

Code: Select all

show pizza at JQuartz_right
This is just an example you don't have to use the coordinates (0.2, 0.5, 0, 0) or the variable name (JQuartz_right) given.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

Mikan
Veteran
Posts: 364
Joined: Sun Dec 23, 2007 12:20 am
Contact:

Re: character images overlap by default (?)

#6 Post by Mikan »

JQuartz wrote:

Code: Select all

init:
    $ JQuartz_right= Position(xpos=0.2,ypos=0.5,xanchor=0,yanchor=0)
And use it like so:

Code: Select all

show pizza at JQuartz_right
Oh, cool. This seems more on par with what I need.
Thanks a lot!

A22
Newbie
Posts: 17
Joined: Fri Sep 14, 2007 2:52 pm
Contact:

Re: character images overlap by default (?)

#7 Post by A22 »

You know, you could just read the Ren'Py Quickstart guide, which answers your questions. Namely this section:
The first part of an image name is the image tag. If an image is being shown, and another image with the same tag is on the screen, then the image that's on the screen is replaced with the one being shown. This happens on line 19, the second show statement. Before line 19 is run, the image "sylvie smile" is on the screen. When line 19 is run, that image is replaces with "sylvie surprised", since they share the "sylvie" tag
Maybe you don't know where the Ren'Py Quickstart guide is. This is understandable, as it is located in a very difficult-to-find area of the deepest reaches of the internets: The Ren'Py site.

http://www.renpy.org/wiki/renpy/doc/tut ... Quickstart

You can learn by asking questions, but all the questions you ask are answered right there.
Might want to read that part a few times especially, since you hide all your images manually, when you do not even have to do that.
It's a good idea to read up on Ren'Py, since you are using it.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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 images overlap by default (?)

#8 Post by PyTom »

A22's post is exactly what we don't need on the forum. I'd rather have a thousand newbie questions, which get answered politely and turn people into welcomed members, than have this place turn into a Megatokyo DSVN forum hotbed of RTFMism.
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: Amazon [Bot], Bing [Bot], Google [Bot]