Skip to content

Commit d5a0669

Browse files
authored
Merge pull request #101 from NoobKazoku/视差
加入视差地图,修复shader
2 parents a230643 + f264008 commit d5a0669

3 files changed

Lines changed: 173 additions & 26 deletions

File tree

scenes/main_menu/main_menu.tscn

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
[gd_scene load_steps=11 format=3 uid="uid://dgnuqqco6xbmw"]
22

33
[ext_resource type="Script" uid="uid://brpe1cvn7jnbp" path="res://scenes/main_menu/MainMenu.cs" id="1_o25w2"]
4-
[ext_resource type="Theme" path="res://resources/theme.tres" id="2_cds3d"]
4+
[ext_resource type="Theme" uid="uid://cfadp5dxx3ld1" path="res://resources/theme.tres" id="2_cds3d"]
55
[ext_resource type="Shader" uid="uid://bo07iwf6vb2x4" path="res://assets/art/tiny_star_test.gdshader" id="2_wem23"]
66
[ext_resource type="Shader" uid="uid://clber8wcbyxn7" path="res://assets/art/bright_star_test.gdshader" id="3_3ovsr"]
77
[ext_resource type="Texture2D" uid="uid://cyctgu4oqqats" path="res://assets/art/planet03.png" id="4_4xg86"]
8-
[ext_resource type="Shader" uid="uid://baqqpsotv4dfc" path="res://assets/art/pixel.gdshader" id="4_5seab"]
8+
[ext_resource type="Shader" uid="uid://yx1hnj3uanro" path="res://scenes/main_menu/main_menu.gdshader" id="4_thkx5"]
99
[ext_resource type="Texture2D" uid="uid://b0ym1yy5pdtxy" path="res://assets/art/标题.png" id="6_3ovsr"]
1010

11-
[sub_resource type="ShaderMaterial" id="ShaderMaterial_x2yjq"]
12-
shader = ExtResource("4_5seab")
11+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5seab"]
12+
shader = ExtResource("2_wem23")
13+
14+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4xg86"]
15+
shader = ExtResource("3_3ovsr")
16+
17+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_thkx5"]
18+
shader = ExtResource("4_thkx5")
1319
shader_parameter/color1 = Color(0.984, 0.961, 0.937, 1)
1420
shader_parameter/color2 = Color(0.949, 0.827, 0.671, 1)
1521
shader_parameter/color3 = Color(0.776, 0.624, 0.647, 1)
1622
shader_parameter/color4 = Color(0.545, 0.427, 0.612, 1)
1723
shader_parameter/color5 = Color(0.286, 0.302, 0.494, 1)
1824
shader_parameter/color6 = Color(0.075, 0.078, 0.18, 1)
1925

20-
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4xg86"]
21-
shader = ExtResource("2_wem23")
22-
23-
[sub_resource type="ShaderMaterial" id="ShaderMaterial_thkx5"]
24-
shader = ExtResource("3_3ovsr")
25-
2626
[node name="MainMenu" type="Control"]
2727
layout_mode = 3
2828
anchors_preset = 15
@@ -32,17 +32,54 @@ grow_horizontal = 2
3232
grow_vertical = 2
3333
script = ExtResource("1_o25w2")
3434

35-
[node name="background" type="Polygon2D" parent="."]
36-
material = SubResource("ShaderMaterial_x2yjq")
37-
polygon = PackedVector2Array(-10000, -10000, 10000, -10000, 10000, 10000, -10000, 10000)
35+
[node name="ColorRect3" type="ColorRect" parent="."]
36+
z_index = -10
37+
layout_mode = 1
38+
anchors_preset = 15
39+
anchor_right = 1.0
40+
anchor_bottom = 1.0
41+
offset_right = 1920.0
42+
offset_bottom = 1080.0
43+
grow_horizontal = 2
44+
grow_vertical = 2
45+
color = Color(0.07450981, 0.078431375, 0.18039216, 1)
3846

39-
[node name="tiny_star" type="Polygon2D" parent="."]
47+
[node name="ColorRect2" type="ColorRect" parent="."]
48+
z_index = -10
49+
material = SubResource("ShaderMaterial_5seab")
50+
layout_mode = 1
51+
anchors_preset = 15
52+
anchor_right = 1.0
53+
anchor_bottom = 1.0
54+
offset_right = 1920.0
55+
offset_bottom = 1080.0
56+
grow_horizontal = 2
57+
grow_vertical = 2
58+
59+
[node name="ColorRect4" type="ColorRect" parent="."]
60+
z_index = -10
4061
material = SubResource("ShaderMaterial_4xg86")
41-
polygon = PackedVector2Array(-10000, -10000, 10000, -10000, 10000, 10000, -10000, 10000)
62+
layout_mode = 1
63+
anchors_preset = 15
64+
anchor_right = 1.0
65+
anchor_bottom = 1.0
66+
offset_right = 1920.0
67+
offset_bottom = 1080.0
68+
grow_horizontal = 2
69+
grow_vertical = 2
4270

43-
[node name="bright_star" type="Polygon2D" parent="."]
71+
[node name="ColorRect" type="ColorRect" parent="."]
72+
z_index = -10
4473
material = SubResource("ShaderMaterial_thkx5")
45-
polygon = PackedVector2Array(-10000, -10000, 10000, -10000, 10000, 10000, -10000, 10000)
74+
layout_mode = 1
75+
anchors_preset = 15
76+
anchor_right = 1.0
77+
anchor_bottom = 1.0
78+
offset_top = -2.0
79+
offset_right = 1920.0
80+
offset_bottom = 1078.0
81+
grow_horizontal = 2
82+
grow_vertical = 2
4683

4784
[node name="Planet03" type="Sprite2D" parent="."]
4885
position = Vector2(275.00006, 649)

scenes/space/space.tscn

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
[gd_scene load_steps=7 format=3 uid="uid://beo8d4p6emdbg"]
1+
[gd_scene load_steps=13 format=3 uid="uid://beo8d4p6emdbg"]
22

33
[ext_resource type="PackedScene" uid="uid://b6hicsjid7hc1" path="res://scenes/space_ship/space_ship.tscn" id="1_t2gi8"]
44
[ext_resource type="Script" uid="uid://udcgk5f8lhmf" path="res://scenes/space/Space.cs" id="1_wfdyj"]
55
[ext_resource type="PackedScene" uid="uid://cdh57f160jys4" path="res://scenes/UI/fuel/fuel.tscn" id="2_ugvpa"]
66
[ext_resource type="PackedScene" uid="uid://b6rprjt4km0f7" path="res://scenes/UI/hot/hot.tscn" id="3_0a2q3"]
77
[ext_resource type="PackedScene" uid="uid://wvy8y4twx6s2" path="res://scenes/UI/cargo/cargo.tscn" id="4_n6hgd"]
8-
[ext_resource type="PackedScene" uid="uid://d0cm2pfa3u3ss" path="res://scenes/tests/test_VFX/background_test.tscn" id="5_x217o"]
8+
[ext_resource type="Shader" uid="uid://bo07iwf6vb2x4" path="res://assets/art/tiny_star_test.gdshader" id="6_5v2dy"]
9+
[ext_resource type="Shader" uid="uid://clber8wcbyxn7" path="res://assets/art/bright_star_test.gdshader" id="7_pcxls"]
10+
[ext_resource type="Texture2D" uid="uid://b6rjw4ajrqvj" path="res://assets/art/空间站.png" id="7_wfdyj"]
11+
[ext_resource type="Shader" uid="uid://yx1hnj3uanro" path="res://scenes/main_menu/main_menu.gdshader" id="8_vho6q"]
12+
13+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0drc4"]
14+
shader = ExtResource("6_5v2dy")
15+
16+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_xm3ba"]
17+
shader = ExtResource("7_pcxls")
18+
19+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pp5mj"]
20+
shader = ExtResource("8_vho6q")
21+
shader_parameter/color1 = Color(0.984, 0.961, 0.937, 1)
22+
shader_parameter/color2 = Color(0.949, 0.827, 0.671, 1)
23+
shader_parameter/color3 = Color(0.776, 0.624, 0.647, 1)
24+
shader_parameter/color4 = Color(0.545, 0.427, 0.612, 1)
25+
shader_parameter/color5 = Color(0.286, 0.302, 0.494, 1)
26+
shader_parameter/color6 = Color(0.075, 0.078, 0.18, 1)
927

1028
[node name="Space" type="Node2D"]
1129
script = ExtResource("1_wfdyj")
1230

13-
[node name="Background" parent="." instance=ExtResource("5_x217o")]
14-
z_index = -10
15-
1631
[node name="AsteroidRoot" type="Node2D" parent="."]
1732
unique_name_in_owner = true
1833

@@ -55,3 +70,56 @@ layout_mode = 2
5570
size_flags_horizontal = 8
5671
size_flags_vertical = 4
5772
metadata/_edit_use_anchors_ = true
73+
74+
[node name="Parallax2D" type="Parallax2D" parent="."]
75+
repeat_size = Vector2(1920, 1080)
76+
77+
[node name="ColorRect3" type="ColorRect" parent="Parallax2D"]
78+
z_index = -10
79+
anchors_preset = 15
80+
anchor_right = 1.0
81+
anchor_bottom = 1.0
82+
offset_right = 1920.0
83+
offset_bottom = 1080.0
84+
grow_horizontal = 2
85+
grow_vertical = 2
86+
color = Color(0.07450981, 0.078431375, 0.18039216, 1)
87+
88+
[node name="ColorRect2" type="ColorRect" parent="Parallax2D"]
89+
z_index = -10
90+
material = SubResource("ShaderMaterial_0drc4")
91+
anchors_preset = 15
92+
anchor_right = 1.0
93+
anchor_bottom = 1.0
94+
offset_right = 1920.0
95+
offset_bottom = 1080.0
96+
grow_horizontal = 2
97+
grow_vertical = 2
98+
99+
[node name="ColorRect4" type="ColorRect" parent="Parallax2D"]
100+
z_index = -10
101+
material = SubResource("ShaderMaterial_xm3ba")
102+
anchors_preset = 15
103+
anchor_right = 1.0
104+
anchor_bottom = 1.0
105+
offset_right = 1920.0
106+
offset_bottom = 1080.0
107+
grow_horizontal = 2
108+
grow_vertical = 2
109+
110+
[node name="ColorRect" type="ColorRect" parent="Parallax2D"]
111+
z_index = -10
112+
material = SubResource("ShaderMaterial_pp5mj")
113+
anchors_preset = 15
114+
anchor_right = 1.0
115+
anchor_bottom = 1.0
116+
offset_top = -2.0
117+
offset_right = 1920.0
118+
offset_bottom = 1078.0
119+
grow_horizontal = 2
120+
grow_vertical = 2
121+
122+
[node name="空间站" type="Sprite2D" parent="."]
123+
z_index = -1
124+
position = Vector2(437, 815)
125+
texture = ExtResource("7_wfdyj")

scenes/tests/test_VFX/background_test.tscn

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
[gd_scene load_steps=31 format=3 uid="uid://d0cm2pfa3u3ss"]
1+
[gd_scene load_steps=33 format=3 uid="uid://d0cm2pfa3u3ss"]
22

33
[ext_resource type="Shader" uid="uid://bo07iwf6vb2x4" path="res://assets/art/tiny_star_test.gdshader" id="1_gi24m"]
44
[ext_resource type="Shader" uid="uid://clber8wcbyxn7" path="res://assets/art/bright_star_test.gdshader" id="2_hwurh"]
55
[ext_resource type="Shader" uid="uid://baqqpsotv4dfc" path="res://assets/art/pixel.gdshader" id="3_mgvpm"]
66
[ext_resource type="FontFile" uid="uid://cr2i4stnkh5fc" path="res://assets/fonts/VonwaonBitmap-16px.ttf" id="4_gb8ji"]
7-
[ext_resource type="Shader" uid="uid://yx1hnj3uanro" path="res://scenes/main_menu/main_menu.gdshader" id="4_mgvpm"]
7+
[ext_resource type="Shader" path="res://scenes/main_menu/main_menu.gdshader" id="4_mgvpm"]
88
[ext_resource type="Texture2D" uid="uid://1xnk8rvurye" path="res://assets/art/oil-6-32x.png" id="5_mvhjx"]
99
[ext_resource type="Shader" uid="uid://bsb0cwho76tw8" path="res://assets/art/line.gdshader" id="6_lmjjp"]
1010
[ext_resource type="Texture2D" uid="uid://cc0kyy84m3qcu" path="res://assets/art/宝石.png" id="7_s6ttp"]
@@ -31,7 +31,13 @@ shader = ExtResource("1_gi24m")
3131
[sub_resource type="ShaderMaterial" id="ShaderMaterial_37kl0"]
3232
shader = ExtResource("2_hwurh")
3333

34+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mgvpm"]
35+
shader = ExtResource("1_gi24m")
36+
3437
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gb8ji"]
38+
shader = ExtResource("2_hwurh")
39+
40+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mvhjx"]
3541
shader = ExtResource("4_mgvpm")
3642
shader_parameter/color1 = Color(0.984, 0.961, 0.937, 1)
3743
shader_parameter/color2 = Color(0.949, 0.827, 0.671, 1)
@@ -100,23 +106,58 @@ colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.019607844)
100106
[node name="control" type="Node2D"]
101107

102108
[node name="background" type="Polygon2D" parent="."]
109+
visible = false
103110
material = SubResource("ShaderMaterial_pvqjq")
104111
polygon = PackedVector2Array(-10000, -10000, 10000, -10000, 10000, 10000, -10000, 10000)
105112

106113
[node name="tiny_star" type="Polygon2D" parent="."]
114+
visible = false
107115
material = SubResource("ShaderMaterial_8uh7m")
108116
polygon = PackedVector2Array(-10000, -10000, 10000, -10000, 10000, 10000, -10000, 10000)
109117

110118
[node name="bright_star" type="Polygon2D" parent="."]
119+
visible = false
111120
material = SubResource("ShaderMaterial_37kl0")
112121
polygon = PackedVector2Array(-10000, -10000, 10000, -10000, 10000, 10000, -10000, 10000)
113122

114-
[node name="ColorRect" type="ColorRect" parent="bright_star"]
123+
[node name="ColorRect3" type="ColorRect" parent="."]
124+
anchors_preset = 15
125+
anchor_right = 1.0
126+
anchor_bottom = 1.0
127+
offset_right = 1920.0
128+
offset_bottom = 1080.0
129+
grow_horizontal = 2
130+
grow_vertical = 2
131+
color = Color(0.07450981, 0.078431375, 0.18039216, 1)
132+
133+
[node name="ColorRect2" type="ColorRect" parent="."]
134+
material = SubResource("ShaderMaterial_mgvpm")
135+
anchors_preset = 15
136+
anchor_right = 1.0
137+
anchor_bottom = 1.0
138+
offset_right = 1920.0
139+
offset_bottom = 1080.0
140+
grow_horizontal = 2
141+
grow_vertical = 2
142+
143+
[node name="ColorRect4" type="ColorRect" parent="."]
115144
material = SubResource("ShaderMaterial_gb8ji")
116-
custom_minimum_size = Vector2(20000, 20000)
117145
anchors_preset = 15
118146
anchor_right = 1.0
119147
anchor_bottom = 1.0
148+
offset_right = 1920.0
149+
offset_bottom = 1080.0
150+
grow_horizontal = 2
151+
grow_vertical = 2
152+
153+
[node name="ColorRect" type="ColorRect" parent="."]
154+
material = SubResource("ShaderMaterial_mvhjx")
155+
anchors_preset = 15
156+
anchor_right = 1.0
157+
anchor_bottom = 1.0
158+
offset_top = -2.0
159+
offset_right = 1920.0
160+
offset_bottom = 1078.0
120161
grow_horizontal = 2
121162
grow_vertical = 2
122163

@@ -247,5 +288,6 @@ angular_velocity_max = 25.0
247288
color_ramp = SubResource("Gradient_icixp")
248289

249290
[node name="空间站" type="Sprite2D" parent="."]
291+
visible = false
250292
position = Vector2(437, 815)
251293
texture = ExtResource("14_hwurh")

0 commit comments

Comments
 (0)