Skip to content

Commit 13bc809

Browse files
committed
Clean up country selected shader. Create a playground scene for testing whatever needs to be tested without affecting the main game.
1 parent 640d151 commit 13bc809

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed
Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,13 @@
11
shader_type canvas_item;
22

3-
//void vertex() {
4-
//// Called for every vertex the material is visible on.
5-
//}
6-
7-
const float frequency = 750.00;
3+
uniform float mix_percentage = .8;
4+
uniform vec4 color: source_color;
85

96
void fragment() {
107
vec4 tex_color = texture(TEXTURE, UV);
11-
vec4 overlay_color = vec4(.3, .3, .9, .8);
12-
13-
// Create a diagonal striped pattern
14-
float stripe = mod((UV.x + UV.y) * frequency, 2) > 1.00 ? 1.0 : 0.0;
15-
16-
// Apply overlay only to non-transparent areas and within stripe pattern
17-
if (tex_color.a > 0.0 && stripe == 1.0) {
18-
COLOR = mix(tex_color, overlay_color, overlay_color.a);
8+
if (tex_color.a == 1.00) {
9+
COLOR = mix(tex_color, color, mix_percentage);
1910
} else {
2011
COLOR = tex_color;
2112
}
2213
}
23-
24-
//void light() {
25-
// Called for every pixel for every light affecting the CanvasItem.
26-
// Uncomment to replace the default light processing function with this one.
27-
//}

entities/countries/selected_country_material.tres

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44

55
[resource]
66
shader = ExtResource("1_bbqy0")
7+
shader_parameter/mix_percentage = 0.8
8+
shader_parameter/color = Color(0.478206, 0.618867, 0.947949, 1)

scenes/playground.tscn

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[gd_scene load_steps=4 format=3 uid="uid://bb5ly26ggsj6b"]
2+
3+
[ext_resource type="Material" uid="uid://du3ukvaptkks8" path="res://entities/countries/selected_country_material.tres" id="1_kde8s"]
4+
[ext_resource type="Texture2D" uid="uid://2oym5s8nxu0p" path="res://art/countries/asia/japan.png" id="2_c5l7r"]
5+
[ext_resource type="Texture2D" uid="uid://chrhq8tlpbple" path="res://art/countries/asia/china.png" id="3_7277p"]
6+
7+
[node name="Playground" type="Node2D"]
8+
9+
[node name="Sprite2D" type="Sprite2D" parent="."]
10+
material = ExtResource("1_kde8s")
11+
position = Vector2(-15108.8, -5546.25)
12+
scale = Vector2(119.5, 44.5)
13+
texture = ExtResource("2_c5l7r")
14+
offset = Vector2(128, 128)
15+
16+
[node name="Sprite2D2" type="Sprite2D" parent="."]
17+
material = ExtResource("1_kde8s")
18+
position = Vector2(24716, -3374)
19+
scale = Vector2(119.5, 44.5)
20+
texture = ExtResource("3_7277p")
21+
offset = Vector2(128, 128)

0 commit comments

Comments
 (0)