Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

inkacorn

1
Posts
A member registered Nov 16, 2023 · View creator page →

Recent community posts

you could always try shaders, heres an example:

# Example shader for vertical gradients
init python:
     renpy.register_shader("example.gradient", variables="""
         uniform vec4 u_gradient_color_1;
         uniform vec4 u_gradient_color_2;
         uniform vec2 u_model_size;
         varying float v_gradient_done;
         attribute vec4 a_position;
     """, vertex_300="""
         v_gradient_done = a_position.y / u_model_size.y;
     """, fragment_300="""
         float gradient_done = v_gradient_done;
         gl_FragColor *= mix(u_gradient_color_1, u_gradient_color_2, gradient_done);
     """)
# Transform that applies the gradient
transform gradientTransform:
     shader "example.gradient"
     u_gradient_color_1 (1.0, 1.0, 1.0, 1.0) # Formatted rgba (1.0 is equivalent to 255)
     u_gradient_color_2 (1.0, 1.0, 0.0, 1.0) # The two colors in the example are white and yellow
# Color is applied manually meaning you cannot change it in text tags sadly
# This block creates the tag and applies it to text
init python:
     def gradient_tag(tag, argument, contents):
         return [(renpy.TEXT_DISPLAYABLE, At(Text(text), gradientTransform())) for _,text in contents]
     config.custom_text_tags["Vgradient"] = gradient_tag
# script.rpy
label start:
     show eileen happy
     e "This text is normal. {Vgradient}This text is yellow.{/Vgradient}"
     show elieen happy at gradientTransform
     e "You can also apply the gradient over sprites!"

the result should look something like this

there are some draw backs to this approach such as text outlines not working and requiring predetermined gradients rather than defining them in the text tag

if you have multiple vertical gradients you need displayed, you can always try this:

# Well create two custom transforms for different colors
transform gradientRedBlue:
      shader "example.gradient"
      u_gradient_color_1 (1.0, 0.0, 0.0, 1.0) # Red
      u_gradient_color_2 (0.0, 0.0, 1.0, 1.0) # Blue
transform gradientPinkWhite:
       shader "example.gradient"
       u_gradient_color_1 (1.0, 0.5, 0.7, 1.0) # Pink
       u_gradient_color_2 (1.0, 1.0, 1.0, 1.0) # White
# This block creates the tag and applies it to text 
init python:
      def red_blue_gradient(tag, argument, contents):
           return [(renpy.TEXT_DISPLAYABLE, At(Text(text), gradientRedBlue())) for _,text in contents]
      def pink_white_gradient(tag, argument, contents):
           return [(renpy.TEXT_DISPLAYABLE, At(Text(text), gradientPinkWhite())) for _,text in contents]
      config.custom_text_tags["RedBlueGradient"] = pink_white_gradient  
      config.custom_text_tags["PinkWhiteGradient"] = pink_white_gradient  
# Please note i have not tested this so it might not work


hope this helps!