-
Notifications
You must be signed in to change notification settings - Fork 1
/
table.tscn
199 lines (166 loc) · 5.06 KB
/
table.tscn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
[gd_scene load_steps=9 format=2]
[ext_resource path="res://images/pool-table.png" type="Texture" id=1]
[ext_resource path="res://table.gd" type="Script" id=2]
[sub_resource type="Shader" id=1]
code = "// https://godotshaders.com/shader/moving-rainbow-gradient/
// HSV to RBG from https://www.rapidtables.com/convert/color/hsv-to-rgb.html
// Rotation matrix from https://en.wikipedia.org/wiki/Rotation_matrix
shader_type canvas_item;
const float PI = 3.1415926535;
uniform float strength: hint_range(0., 1.) = 0.5;
uniform float speed: hint_range(0., 10.) = 0.5;
uniform float angle: hint_range(0., 360.) = 0.;
void fragment() {
float hue = UV.x * cos(radians(angle)) - UV.y * sin(radians(angle));
hue = fract(hue + fract(TIME * speed));
float x = 1. - abs(mod(hue / (1./ 6.), 2.) - 1.);
vec3 rainbow;
if(hue < 1./6.){
rainbow = vec3(1., x, 0.);
} else if (hue < 1./3.) {
rainbow = vec3(x, 1., 0);
} else if (hue < 0.5) {
rainbow = vec3(0, 1., x);
} else if (hue < 2./3.) {
rainbow = vec3(0., x, 1.);
} else if (hue < 5./6.) {
rainbow = vec3(x, 0., 1.);
} else {
rainbow = vec3(1., 0., x);
}
vec4 color = texture(TEXTURE, UV);
COLOR = mix(color, vec4(rainbow, color.a), strength);
}"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/strength = 0.4
shader_param/speed = 0.2
shader_param/angle = 45.0
[sub_resource type="OpenSimplexNoise" id=3]
[sub_resource type="NoiseTexture" id=4]
width = 934
height = 500
seamless = true
bump_strength = 32.0
noise = SubResource( 3 )
[sub_resource type="PhysicsMaterial" id=5]
friction = 0.5
bounce = 0.5
[sub_resource type="CircleShape2D" id=6]
radius = 24.0
[node name="table" type="Area2D"]
collision_mask = 2
script = ExtResource( 2 )
[node name="TextureRect" type="TextureRect" parent="."]
margin_right = 1024.0
margin_bottom = 600.0
texture = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Shader" type="TextureRect" parent="."]
visible = false
modulate = Color( 0.34902, 0.827451, 1, 0.380392 )
self_modulate = Color( 1, 1, 1, 0.498039 )
material = SubResource( 2 )
margin_left = 46.0
margin_top = 50.0
margin_right = 980.0
margin_bottom = 550.0
texture = SubResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="top1" type="StaticBody2D" parent="." groups=[
"table",
]]
collision_mask = 2
physics_material_override = SubResource( 5 )
__meta__ = {
"_edit_lock_": true
}
[node name="segment" type="CollisionPolygon2D" parent="top1"]
position = Vector2( -84.9092, 2 )
scale = Vector2( 0.609792, 1 )
build_mode = 1
polygon = PoolVector2Array( 205, 0, 268, 32, 940, 32, 970, 0 )
[node name="top2" type="StaticBody2D" parent="." groups=[
"table",
]]
collision_mask = 2
physics_material_override = SubResource( 5 )
__meta__ = {
"_edit_lock_": true
}
[node name="segment" type="CollisionPolygon2D" parent="top2"]
position = Vector2( 510.339, 2 )
scale = Vector2( 0.588967, 1 )
build_mode = 1
polygon = PoolVector2Array( 55, 0, 85, 32, 746, 32, 805, 0 )
[node name="left" type="StaticBody2D" parent="." groups=[
"table",
]]
collision_mask = 2
physics_material_override = SubResource( 5 )
__meta__ = {
"_edit_lock_": true
}
[node name="segment" type="CollisionPolygon2D" parent="left"]
build_mode = 1
polygon = PoolVector2Array( 0, 48, 32, 77, 32, 526, 0, 550 )
[node name="right" type="StaticBody2D" parent="." groups=[
"table",
]]
collision_mask = 2
physics_material_override = SubResource( 5 )
__meta__ = {
"_edit_lock_": true
}
[node name="segment" type="CollisionPolygon2D" parent="right"]
position = Vector2( 992, 1.08309 )
scale = Vector2( 1, 0.994519 )
build_mode = 1
polygon = PoolVector2Array( 0, 76, 32, 48, 32, 550, 0, 528 )
[node name="bottom1" type="StaticBody2D" parent="." groups=[
"table",
]]
collision_mask = 2
physics_material_override = SubResource( 5 )
__meta__ = {
"_edit_lock_": true
}
[node name="segment" type="CollisionPolygon2D" parent="bottom1"]
position = Vector2( -14, 565.652 )
build_mode = 1
polygon = PoolVector2Array( 90, 0, 60, 32, 518, 32, 502, 0 )
[node name="bottom2" type="StaticBody2D" parent="." groups=[
"table",
]]
collision_mask = 2
physics_material_override = SubResource( 5 )
__meta__ = {
"_edit_lock_": true
}
[node name="segment" type="CollisionPolygon2D" parent="bottom2"]
position = Vector2( 411, 565 )
build_mode = 1
polygon = PoolVector2Array( 150, 0, 130, 32, 570, 32, 538, 0 )
[node name="hoyo1" type="CollisionShape2D" parent="."]
position = Vector2( 12.2396, 12.9917 )
shape = SubResource( 6 )
[node name="hoyo2" type="CollisionShape2D" parent="."]
position = Vector2( 1011.01, 12.9917 )
shape = SubResource( 6 )
[node name="hoyo3" type="CollisionShape2D" parent="."]
position = Vector2( 9.23135, 587.76 )
shape = SubResource( 6 )
[node name="hoyo4" type="CollisionShape2D" parent="."]
position = Vector2( 1016.27, 586.256 )
shape = SubResource( 6 )
[node name="hoyo5" type="CollisionShape2D" parent="."]
position = Vector2( 524, -4 )
shape = SubResource( 6 )
[node name="hoyo6" type="CollisionShape2D" parent="."]
position = Vector2( 524, 605.256 )
shape = SubResource( 6 )
[connection signal="body_entered" from="." to="." method="_on_table_body_entered"]