Page 1 of 1
How to display certain images on a conditional?
Posted: Fri Oct 22, 2021 10:52 am
by Gummysaur
Hello, I have a game I'm making, and in the settings menu I give the player the option to control how the sprites look. So far I have an option to make the characters slightly transparent, and one to make them pixellated. Now, my question is, is there a good way to do this, instead of needing to do something like this *every* single time a character is displayed:
Code: Select all
if persistent.transparent == True:
show ch_steven_neutral at center:
alpha .9
else:
show ch_steven_neutral at center
if persistent.transparent == True:
show ch_niko_neutral at left with easeinleft:
alpha .9
else:
show ch_niko_neutral at left with easeinleft
I was thinking of making a display character function which takes a character and emotion as an input and displays the correct image depending on which setting has been selected, but I'm not very skilled with Python or Ren'py itself and I'm not sure how that would work. Any help would be appreciated!
Re: How to display certain images on a conditional?
Posted: Fri Oct 22, 2021 12:03 pm
by Ocelot
Example of changing applied transform effects in-game:
Code: Select all
image steve = Placeholder("boy")
transform do_nothing:
pass
transform ghost:
alpha 0.5
default sprite_effects = do_nothing
label start:
show steve at center, sprite_effects
'....'
$ sprite_effects = ghost
show steve at center, sprite_effects
' ... '
return
Just assign whatever transform you need to the sprite_effects transform once on start (or when user changes preference) and just apply that transform to all images which need to be affected by it.
Re: How to display certain images on a conditional?
Posted: Fri Oct 22, 2021 7:07 pm
by Gummysaur
Thank you!
Re: How to display certain images on a conditional?
Posted: Sat Oct 23, 2021 2:15 pm
by bloobeary
I was about to ask a similar question, but my question is about alternate character images depending on choices made by the player.
Basically, I have a character who is supposed to be wearing one of three outfits, depending on earlier player choices.
Rather than doing something like this:
...how would I go about using different images for the character?
Re: How to display certain images on a conditional?
Posted: Sat Oct 23, 2021 3:43 pm
by HEXdidnt
bloobeary wrote: ↑Sat Oct 23, 2021 2:15 pm
I was about to ask a similar question, but my question is about alternate character images depending on choices made by the player.
Basically, I have a character who is supposed to be wearing one of three outfits, depending on earlier player choices.
This may be overkill for what you're trying to achieve, but I found
this thread super-useful in setting up a LayeredImage for outfits, etc.
It helped me set things up so that I can make multiple, small changes to both expression and appearance with very simple variable changes. These can then be defined as complete images in advance, or changes can be made on-the-fly. (
My own thread, in case that's any use).
Other than that, there are a few 'Paper Doll'/'Dress-up' tutorial 'games' available for LayeredImage and ConditionSwitch, and sifting through their code can be very instructive.
Re: How to display certain images on a conditional?
Posted: Sat Oct 23, 2021 3:44 pm
by Ocelot
bloobeary wrote: ↑Sat Oct 23, 2021 2:15 pm
I was about to ask a similar question, but my question is about alternate character images depending on choices made by the player.
Basically, I have a character who is supposed to be wearing one of three outfits, depending on earlier player choices.
Rather than doing something like this:
...how would I go about using different images for the character?
https://www.renpy.org/doc/html/displaya ... tionSwitch