Devlog #3: Transitions!
Hi again!
The game finally has a transition system to make scene-switching look nicer. This was done by creating a shader that’s applied to a ColorRect node. The first shader i made took in a progress variable ranging from 0 to 1, which tells it how far along the transition it’s supposed to be. For a very simple slide transition, we only have to make the ColorRect black if the pixel’s UV’s x component is smaller than progress:
void fragment() {
if (UV.x < progress) {
COLOR = vec4(0,0,0,1);
}
}
However, since I didn’t want to create a separate shader to end the Transition, I decided to include two progress variables: startProgress and endProgress, which can then be used to apply the shader to a section of the ColorRect like so:
void fragment() {
if (UV.x < startProgress && UV.x > endProgress) {
COLOR = vec4(0,0,0,1);
} else {
COLOR = vec4(0,0,0,0);
}
}
The timing of the transition itself is handled using Godot’s tweens in a singleton. The result can be seen in the attached file.
Other new features
- The game now has a very simple main menu
- The player has the ability to restart the game when the they lose.
Until next time!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.