74 lines
1.8 KiB
Plaintext
74 lines
1.8 KiB
Plaintext
[gd_scene load_steps=4 format=2]
|
|
|
|
[ext_resource path="res://scripts/GameField.gd" type="Script" id=1]
|
|
|
|
[sub_resource type="Shader" id=1]
|
|
code = "shader_type canvas_item;
|
|
|
|
uniform float rows = 44.0; // Really int but don't want to recast all the time
|
|
uniform float cols = 63.0; // ^
|
|
|
|
void fragment(){
|
|
vec2 frag_pos = UV * vec2(cols, rows);
|
|
vec2 frag_marginal = fract(frag_pos+0.05);
|
|
vec2 frag_marginal_2 = fract(frag_pos-0.4);
|
|
vec2 grid_data = texture(TEXTURE, (frag_pos+0.05)/vec2(cols+1.0, rows+1.0)).rg;
|
|
COLOR = vec4(0.0);
|
|
if (frag_marginal.x < 0.1){
|
|
if (grid_data.g >= 0.99){
|
|
if (frag_marginal_2.y <= 0.2)
|
|
COLOR = vec4(1.0, 0.0, 0.0, 1.0);
|
|
}else if (grid_data.g >= 0.49){
|
|
COLOR = vec4(0.0, 0.0, 1.0, 1.0);
|
|
}else
|
|
COLOR = vec4(0.5, 0.5, 0.5, 1.0);
|
|
}
|
|
if (frag_marginal.y < 0.1){
|
|
if (grid_data.r >= 0.99){
|
|
if (frag_marginal_2.x <= 0.2)
|
|
COLOR = vec4(1.0, 0.0, 0.0, 1.0);
|
|
}else if (grid_data.r >= 0.49){
|
|
COLOR = vec4(0.0, 0.0, 1.0, 1.0);
|
|
}else
|
|
COLOR = vec4(0.5, 0.5, 0.5, 1.0);
|
|
}
|
|
}"
|
|
|
|
[sub_resource type="ShaderMaterial" id=2]
|
|
shader = SubResource( 1 )
|
|
shader_param/rows = 44.0
|
|
shader_param/cols = 63.0
|
|
|
|
[node name="Control" type="Control"]
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
size_flags_horizontal = 3
|
|
size_flags_vertical = 3
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|
|
|
|
[node name="GameField" type="ColorRect" parent="."]
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
size_flags_horizontal = 3
|
|
size_flags_vertical = 3
|
|
color = Color( 0.8, 0.8, 0.8, 1 )
|
|
script = ExtResource( 1 )
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|
|
|
|
[node name="TextureRect" type="TextureRect" parent="GameField"]
|
|
material = SubResource( 2 )
|
|
margin_top = -2.0
|
|
margin_right = 40.0
|
|
margin_bottom = 38.0
|
|
expand = true
|
|
stretch_mode = 1
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|