[SOLVED] How to temporarily hide character sprites?

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
Dacuna
Newbie
Posts: 24
Joined: Wed Dec 20, 2017 4:15 pm
Contact:

[SOLVED] How to temporarily hide character sprites?

#1 Post by Dacuna » Mon Jul 20, 2020 2:25 am

Hi everyone,
At a certain point in the game, the player can choose an option to look at his surroundings.
When the option is chosen, their sprite disappears to give the player a full shot of the background.
Unfortunately, when the sprite has to reappear, I have to use the "show" command to put the sprite back in the right place and the right direction.
Simple enough, but it comes with a lot of difficulties. What if there are more characters? What if a character isn't in the scene yet? It's possible with variables, but it gets very confusing very fast.
Is it possible to either save the location and number of sprites on screen for when they reappear, or maybe show a background image over an existing scene and hide it when finished?

Thanks for any help!
Last edited by Dacuna on Wed Jul 22, 2020 12:01 am, edited 1 time in total.

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

Re: How to temporarily hide character sprites?

#2 Post by Imperf3kt » Mon Jul 20, 2020 4:27 am

You could hide/show the layer maybe.
Its not something I've fiddled with, but the documentation it done other forum members should start you right.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

Dacuna
Newbie
Posts: 24
Joined: Wed Dec 20, 2017 4:15 pm
Contact:

Re: How to temporarily hide character sprites?

#3 Post by Dacuna » Mon Jul 20, 2020 8:14 pm

I've fiddled a bit with layers beforehand, but I haven't come across a solution yet. It seems as though both the background and character sprites are kept on the same "master" layer, so that doesn't seem to help much, unless I put all my sprites on a user-defined layer, which seems like it could carry some difficulties in its own right. I'll try to keep toying around with it, but more help would be appreciated.

Edit: Also, is it just me, or does "hide layer master" do literally nothing? I would expect it would at least hide all background and sprite images on screen.

TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: How to temporarily hide character sprites?

#4 Post by TheChatotMaestro » Tue Jul 21, 2020 3:52 pm

At the risk of saying something stupid... Maybe just show a copy of the 'background' image on top of all the sprites? Then you wouldn't have to move them at all. If you faded it in right, and it matched the background, it would look like all the sprites faded out.

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

Re: How to temporarily hide character sprites?

#5 Post by Imperf3kt » Tue Jul 21, 2020 5:45 pm

TheChatotMaestro wrote:
Tue Jul 21, 2020 3:52 pm
At the risk of saying something stupid... Maybe just show a copy of the 'background' image on top of all the sprites? Then you wouldn't have to move them at all. If you faded it in right, and it matched the background, it would look like all the sprites faded out.
While this would work, I would advise against it.
This will negatively impact performance as hiding sprites removes them from ram, but adding a picture over the top only increases ram usage.

After a while, you'll end up with some issues.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

Dacuna
Newbie
Posts: 24
Joined: Wed Dec 20, 2017 4:15 pm
Contact:

Re: How to temporarily hide character sprites?

#6 Post by Dacuna » Wed Jul 22, 2020 12:00 am

Yes! It worked!
I actually tried something similar before to no avail, but this time, I created an image in-script of the background image but removed the "bg" tag. If I don't, it'll remove the other background and still be behind the character sprites.
As for performance issues, while I totally agree it's not ideal, I doubt it'll be worth worrying about. I mean, that background image is going to get hidden as soon as the player finishes looking at it. I'm no expert so correct me if I'm wrong, but I doubt one temporary image is going to tax your ram noticeably.
In the meantime, thank you TheChatotMaestro!

Post Reply

Who is online

Users browsing this forum: Google [Bot]