Ren'Py [Solved]how to clear all images

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,464
3,410
500
how to clear all images

will this help?

$ renpy.hide()

I already know about this


just want to know if there away to clear all images with one code
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,663
2,355
462
To what end?

How many images are you expecting to need to hide?

Do you need to show those same images again? (that is, is it a "temporary" hide - like hiding the UI?)

You've already mentioned which would be my normal answer.

Going to take a stab in the dark, and assume you're talking about sprites - in which case the answer might be .

When image names are separated by spaces, the part of the name before the first space is known as the image tag. All the ones after that are the image attributes. This can be done by either naming the filenames with spaces in the first place or using statements.
The short version is that only one image with a unique tag can appear on screen at a time.

So if you had three files:
  • mary night jeans.png
  • mary day joggers.png
  • mary evening dress.png

In this example, the image tag is mary. All newly used mary images will replace older ones.

So code:

Python:
    scene black with fade

    show mary day joggers with dissolve
    "first outfit"
    show mary evening dress with dissolve
    "second outfit"

The image of Mary wearing a dress will replace the first image, rather than stacking up on top of the first.

Now, none of this is hiding all images. So may not be what you are looking for. But it is a good way of not needing to worry about what was previously on screen when showing a new image - as long as that new image is a direct replacement for the old one.

In old school games, before scene became more commonplace, it was usual to name the background images as things like bg scene01_img01. Where bg was nice organised way of constantly changing the background image without leaving old images hidden behind newer images and without the UI disappearing and reappearing like you get with scene. Which was fine until some inexperienced devs, not realizing the significance of the space in the filename (or image statement) started removing the spaces. Then suddenly you've got games with literal hundreds of background images being active at the same time.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
12,935
21,517
1,026
You've already mentioned which would be my normal answer.
It's surely possible to look at the code behind scene and make a hide all custom statement. But the advantage would be null.

Ren'Py redraw the whole scene regularly, at least once for each interaction. What mean that a hide all would do the same than what scene is already doing. The only difference between that scene would explicitly say what is the background (probably the currently displayed one), while with hide all it would be implicit.