4.6, new attack, enemy spawning, shaders, bunch of stuff

This commit is contained in:
Daniel Kauss Serna 2026-02-17 01:24:05 +01:00
parent e08e3ebb13
commit 19517a3176
84 changed files with 13348 additions and 91399 deletions

View file

@ -1,13 +1,28 @@
shader_type canvas_item;
uniform sampler2D mask; // a texture
uniform float progress : hint_range(0.0, 1.0, 0.001);
uniform sampler2D noise_texture : repeat_disable, filter_nearest;
uniform float progress : hint_range(0.0, 1.0) = 0.0;
uniform float edge_softness : hint_range(0.0, 0.5) = 0.0;
void fragment() {
float mask_value = texture(mask, UV).r;
vec4 sprite_color = texture(TEXTURE, UV);
float noise_val = texture(noise_texture, UV).r;
// ensure the progress is a bit bigger than the feather
float threshold = progress * 1.001;
// Fade alpha based on mask vs. threshold with a feather
COLOR.a *= smoothstep(threshold, threshold * 0.999, mask_value);
float phase1_progress = clamp(progress * 2.0, 0.0, 1.0);
float phase2_progress = clamp((progress - 0.5) * 2.0, 0.0, 1.0);
float visibility = smoothstep(noise_val - edge_softness, noise_val + edge_softness, phase1_progress);
float color_transition = smoothstep(noise_val - edge_softness, noise_val + edge_softness, phase2_progress);
vec4 white_color = vec4(1.0, 1.0, 1.0, sprite_color.a);
vec4 final_color = mix(white_color, sprite_color, color_transition);
final_color.a *= visibility;
COLOR = final_color;
}

30
shaders/space.gdshader Normal file
View file

@ -0,0 +1,30 @@
shader_type canvas_item;
// The color you want to replace (e.g., your #325512 background)
uniform vec4 key_color : source_color = vec4(0.196, 0.333, 0.071, 1.0);
// How close the color needs to be to match (0.01 to 0.1 is usually best)
uniform float sensitivity : hint_range(0.0, 1.0) = 0.05;
// Read the screen behind this shader
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
void fragment() {
// 1. Get the original color of the screen at this position
vec4 screen_color = texture(screen_texture, SCREEN_UV);
// 2. Calculate the difference between the screen pixel and our target color
// We use the distance formula in 3D space:
// d = sqrt((r1-r2)^2 + (g1-g2)^2 + (b1-b2)^2)
float diff = distance(screen_color.rgb, key_color.rgb);
if (diff <= sensitivity) {
// --- START YOUR EFFECT HERE ---
// Example: Making it pulse red
vec3 effect = screen_color.rgb + vec3(sin(TIME) * 0.5, 0.0, 0.0);
COLOR = vec4(effect, screen_color.a);
// --- END YOUR EFFECT HERE ---
} else {
// If it's NOT the target color, draw the screen exactly as it is
COLOR = screen_color;
}
}

View file

@ -0,0 +1 @@
uid://dmgvx36v2kttq

View file

@ -0,0 +1,50 @@
shader_type canvas_item;
// Your original target color detection
uniform vec4 target_color : source_color = vec4(0.0, 0.007, 0.939, 1.0);
uniform float color_tolerance : hint_range(0.0, 1.0) = 0.05;
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
// New uniforms for the smooth rainbow edge effect
uniform float color_shift_intensity : hint_range(0.0, 0.2) = 0.08;
uniform float edge_rainbow_spread : hint_range(0.1, 5.0) = 2.0;
uniform float shift_speed : hint_range(0.0, 5.0) = 1.0;
uniform float scanline_intensity : hint_range(0.0, 1.0) = 0.15;
void fragment() {
vec4 original_screen_color = texture(screen_texture, SCREEN_UV);
if (distance(original_screen_color.rgb, target_color.rgb) > color_tolerance) {
COLOR = original_screen_color;
} else {
vec2 uv = SCREEN_UV;
vec2 center_offset = uv - vec2(0.5);
float dist_from_center = length(center_offset);
float edge_factor = pow(dist_from_center, edge_rainbow_spread);
float time_sin = sin(TIME * shift_speed) - 1.2;
float time_cos = cos(TIME * shift_speed * 0.8) - 1.2;
//float time_sin = sin(dist_from_center * shift_speed);
//float time_cos = cos(dist_from_center * shift_speed * 0.8);
//vec2 red_offset = center_offset * color_shift_intensity * edge_factor * time_sin;
//vec2 blue_offset = center_offset * color_shift_intensity * edge_factor * -time_cos;
//vec2 green_offset = center_offset * color_shift_intensity * edge_factor * (time_sin * 0.5);
vec2 red_offset = vec2(0.1, 0.5) * color_shift_intensity * time_sin;
vec2 blue_offset = vec2(-0.1, 0.5) * color_shift_intensity * -time_cos;
vec2 green_offset = vec2(-0.1, -0.5) * color_shift_intensity * (time_sin);
float r = texture(screen_texture, uv + red_offset).r;
float g = texture(screen_texture, uv + green_offset).g;
float b = texture(screen_texture, uv + blue_offset).b;
vec4 final_color = vec4(r, g, b, 1.0);
//float scanline = sin(uv.y * 400.0 - TIME * 2.0) * 0.2 + 1.;
//final_color.rgb *= scanline * scanline_intensity;
COLOR = final_color;
}
}

View file

@ -0,0 +1 @@
uid://bbhp5s27af6xg