Displaying day/night sprite with variable
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.
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.
- SundownKid
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Displaying day/night sprite with variable
I am looking for a way to switch between the day or night versions of a sprite without having to type in "show dude normal night at center". Basically, I am looking to change a variable such as "daytime = True" and have the character sprite automatically switch to the daytime image. Is there any way to do that when you define the image?
- Stainless_Steel
- Regular
- Posts: 56
- Joined: Mon Jun 25, 2012 11:03 pm
- Location: TX, USA
- Contact:
Re: Displaying day/night sprite with variable
You could try a condition switch:
then you just switch using the variables
Though it'd get more complicated if your making the day and night versions by tinting the image in renpy, not sure how you'd do it then.
Code: Select all
image character = ConditionSwitch(
"time_of_day == 'day'", "character_day.jpg",
"time_of_day == 'night'", "character_night.jpg",
)Code: Select all
$ time_of_day= day
$ time_of_day = night
- junna
- Veteran
- Posts: 347
- Joined: Sat Sep 08, 2012 4:16 am
- Projects: DreamWalker; History; Adversity Competition
- Contact:
Re: Displaying day/night sprite with variable
doing it with image tints could mean that you have to tint the characters firstStainless_Steel wrote:You could try a condition switch:
then you just switch using the variablesCode: Select all
image character = ConditionSwitch( "time_of_day == 'day'", "character_day.jpg", "time_of_day == 'night'", "character_night.jpg", )Though it'd get more complicated if your making the day and night versions by tinting the image in renpy, not sure how you'd do it then.Code: Select all
$ time_of_day= day $ time_of_day = night
Code: Select all
image characternight = im.MatrixColor("characterday.jpg",
im.matrix.saturation(0.5)*im.matrix.tint(.44,.44,.93)*im.matrix.brightness(-0.05))Code: Select all
image character = ConditionSwitch(
"time_of_day == 'day'", "character_day.jpg",
"time_of_day == 'night'", ImageReference ("characternight"),
)- SundownKid
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Re: Displaying day/night sprite with variable
Thanks! This works perfectly - now my characters can have night versions.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]



