Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Bob Conway 5/2/2020
- # twitter.com/bobcgames
- # Improved automatic renpy sprite darkening
- # Better than https://pastebin.com/NtY3PHP2 for layeredimages
- # TODO: Automatically determine size instead of having to pass it in
- init python:
- class DarkenedImageProxy(LayeredImageProxy):
- def __init__(self, name, sz, transform=None, darkenvar=None):
- LayeredImageProxy.__init__(self, name, transform)
- self.sz = sz
- self.darkenvar = darkenvar
- def _duplicate(self, args):
- rv = LayeredImageProxy._duplicate(self, args)
- return ConditionSwitch(self.darkenvar, Composite(self.sz, (0,0), rv, (0,0), AlphaMask(Transform("#000a", size=self.sz), rv)), "True", rv)
- default dark_time = False
- layeredimage adam:
- # Assumes some existing definition here
- layeredimage james:
- # Assumes some existing definition here
- image darkenedadam = DarkenedImageProxy("adam", (788, 1500), darkenvar="dark_time")
- image darkenedjames = DarkenedImageProxy("james", (788, 1495), darkenvar="dark_time")
- label darktest:
- scene campuswinternight
- "Start"
- show darkenedadam crossed happy tgreen jeansblue at left
- show darkenedjames happy coatbag crossed buttonblue cargotan at right
- adam "This is a test."
- $ dark_time = True
- show darkenedadam sides neutral
- adam "Now it's dark out and that reflects on me and James."
- $ dark_time = False
- show darkenedadam questioning
- adam "And now it's weirdly light out again."
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement