Description
raising the bar for gamemaker tutorials
// Fragment shader
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float time;
uniform bool smooth;
uniform float thickness;
uniform float stripes;
void main()
{
float mask = texture2D( gm_BaseTexture, v_vTexcoord ).a;
float pointInTime = 1.0 - texture2D( gm_BaseTexture, v_vTexcoord ).r;
vec4 outColour = vec4(1.0, 1.0, 1.0, 0.0);
if (mask BIGGER_THAN 0.0) {
float _distance = abs(mod(pointInTime * stripes, 1.0) - mod(time, 1.0)) * 2.0;
if (_distance BIGGER_THAN 1.0) {
_distance = 1.0 - (_distance - 1.0);
}
float _distance2 = _distance / stripes;
if (_distance2 SMALLER_THAN thickness) {
float _normalizedDistance = (_distance2 / thickness);
float _alpha = smooth ? (1.0 - _normalizedDistance) : 1.0;
outColour.a = _alpha;
}
}
gl_FragColor = v_vColour * outColour;
}
// utility script:
function shader_set_shield(time, smooth, thickness, stripes){
var uni_time = shader_get_uniform(Shader1, "time");
var uni_smooth = shader_get_uniform(Shader1, "smooth");
var uni_thickness = shader_get_uniform(Shader1, "thickness");
var uni_stripes = shader_get_uniform(Shader1, "stripes");
shader_set(Shader1);
shader_set_uniform_f(uni_time, time);
shader_set_uniform_i(uni_smooth, smooth);
shader_set_uniform_f(uni_thickness, thickness);
shader_set_uniform_f(uni_stripes, stripes);
}
// how to use example:
shader_set_shield((current_time * 0.0005), true, 0.1, 3.33);
draw_self();
shader_reset();
00:00 - intro
0:27 - tldw version
0:44 - impress your friends (with lyrics)
2:21 - features
2:50 - bonus blender tutorial for making a shield gradient
3:24 - implementing for noob
4:38 - uniform time bb
6:08 - mask out the stripes
10:03 - how to loop it gorgeously
10:42 - how to multiple stripes
12:07 - making it convenient for later (since you will forget everything)
13:17 - ok wow that was easy
ty for the view. pls share if you liked the video or know someone who might like the video. pls wishlist wuppo BFF https://store.steampowered.com/app/1321160/Wuppo_Breft_Festival_Forever/ 🌟. subscribe for more if you need to.
🎵Music🎵
youtube audio library
greencream https://soundcloud.com/greencreamreal
styze soulmaker https://www.youtube.com/styzesoulmaker
like, comment, share, consume, multiply, sell the video. thx💚 & remember to buy wuppo
#greencream #plsbuywuppo #plsbuywuppoBFF
✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌
------------------------------------------------
hello I am LARS. I do art/writing/code/design/tweets for a game studio called: Knuist & Perzik, created Wuppo (the best game ever), but this youtube channel is where I upload all kinds of bad content. hope you enjoy. thank you for the view.
games 🎮 ➤ http://knuistperzik.com/ (overwhelmingly positive)
music 🎵 ➤ https://open.spotify.com/artist/32SPa82Ahvqoa64Mz9xk5S
videos 📹 ➤ https://www.youtube.com/greencream?sub_confirmation=1 (subscribe)
Buy Wuppo = http://store.steampowered.com/app/400630/Wuppo/ 🙏
Wishlist Wuppo: Breft Festival (Forever) = https://store.steampowered.com/app/1321160/Wuppo_Breft_Festival_Forever/ 🌟