More work on combat
This commit is contained in:
26
shaders/nonvariant_sprite.gdshader
Normal file
26
shaders/nonvariant_sprite.gdshader
Normal file
@@ -0,0 +1,26 @@
|
||||
shader_type canvas_item;
|
||||
render_mode blend_mix;
|
||||
|
||||
uniform bool flash;
|
||||
uniform float flash_strength = 0.4;
|
||||
uniform vec4 highlight : source_color = vec4(1,1,1,0);
|
||||
|
||||
|
||||
void vertex() {
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec4 col = texture(TEXTURE, UV);
|
||||
|
||||
vec4 h = highlight;
|
||||
if(flash){
|
||||
h.a = flash_strength * (sin(TIME * 10.0) + 1.0)/2.0;
|
||||
}
|
||||
//COLOR.r *= col.r;
|
||||
//COLOR.g *= col.g;
|
||||
//COLOR.b *= col.b;
|
||||
COLOR.rgb = mix(COLOR.rgb, h.rgb, h.a);
|
||||
COLOR.a = col.a * COLOR.a;
|
||||
|
||||
|
||||
}
|
||||
1
shaders/nonvariant_sprite.gdshader.uid
Normal file
1
shaders/nonvariant_sprite.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ctod7r3yre02d
|
||||
@@ -8,7 +8,7 @@ uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_n
|
||||
|
||||
|
||||
void fragment() {
|
||||
vec2 size = SCREEN_PIXEL_SIZE * float(line_thickness*2.0);
|
||||
vec2 size = SCREEN_PIXEL_SIZE * float(line_thickness*4.0);
|
||||
float line_alpha = 0.0;
|
||||
for (float i = -size.x; i <= size.x; i += SCREEN_PIXEL_SIZE.x) {
|
||||
for (float j = -size.y; j <= size.y; j += SCREEN_PIXEL_SIZE.y) {
|
||||
@@ -16,7 +16,7 @@ void fragment() {
|
||||
}
|
||||
}
|
||||
float div = size.x*2.0/SCREEN_PIXEL_SIZE.x + size.y*2.0/SCREEN_PIXEL_SIZE.y;
|
||||
line_alpha = .2 * (line_alpha / div) + 0.0 * sign(line_alpha);
|
||||
line_alpha = .1 * (line_alpha / div);
|
||||
vec4 colour = texture(screen_texture, SCREEN_UV);
|
||||
vec4 outline = vec4(line_color.rgb, min(line_alpha, 1.0));
|
||||
COLOR *= mix(outline, colour, colour.a);
|
||||
|
||||
Reference in New Issue
Block a user