game: use shader instead of sprite for xp orbs

This commit is contained in:
2025-08-21 10:59:50 +02:00
parent 9240413da7
commit 3e12c386c2
3 changed files with 44 additions and 5 deletions

View File

@@ -0,0 +1,24 @@
shader_type canvas_item;
uniform vec4 orb_color : source_color = vec4(0.2, 1.0, 0.5, 1.0); // base orb color
uniform float glow_strength : hint_range(0.0, 2.0) = 1.2;
uniform float pulse_speed : hint_range(0.0, 10.0) = 2.0;
void fragment() {
// Centered UV (0,0 in middle, -1..1 range)
vec2 uv = (UV - vec2(0.5)) * 2.0;
float dist = length(uv);
// Soft circular mask
float circle = smoothstep(0.8, 0.0, dist);
// Glow falloff
float glow = smoothstep(0.5, 0.0, dist) * glow_strength;
// Pulsing
float pulse = 0.5 + 0.5 * sin(TIME * pulse_speed);
vec3 color = orb_color.rgb * (circle + glow * pulse);
COLOR = vec4(color, circle); // alpha fades at edges
}