Initial project sync

This commit is contained in:
wxm
2026-07-06 22:55:14 -07:00
commit 8cca00d0da
1066 changed files with 58585 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
[gd_scene format=3 uid="uid://cs0rhloanh2u4"]
[ext_resource type="Texture2D" uid="uid://df1i0jo40oefn" path="res://assets/art/ground/ground.png" id="1_au3k8"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_au3k8"]
size = Vector2(4105, 1)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rrkwn"]
resource_name = "RectangleShape2D_left_boundary"
size = Vector2(32, 900)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xmv3o"]
resource_name = "RectangleShape2D_right_boundary"
size = Vector2(32, 900)
[node name="ground" type="Node2D" unique_id=656914049]
[node name="StreetUnderfill" type="Polygon2D" parent="." unique_id=2126258380]
visible = false
color = Color(0.078, 0.065, 0.09, 1)
polygon = PackedVector2Array(-22, 540, 4116, 540, 4116, 920, -22, 920)
[node name="GroundAnchor" type="Marker2D" parent="." unique_id=1875450741]
position = Vector2(2047, 366)
[node name="GroundBody" type="StaticBody2D" parent="." unique_id=1583776637]
position = Vector2(2047, 366)
collision_mask = 0
[node name="Sprite2D" type="Sprite2D" parent="GroundBody" unique_id=376657383]
texture_filter = 2
scale = Vector2(1.7979, 1.7979)
texture = ExtResource("1_au3k8")
centered = false
offset = Vector2(-1150.5, -480)
region_enabled = true
region_rect = Rect2(0, 90, 2301, 593)
[node name="CollisionShape2D" type="CollisionShape2D" parent="GroundBody" unique_id=629550857]
position = Vector2(7, -133.5)
shape = SubResource("RectangleShape2D_au3k8")
[node name="LeftBoundaryBody" type="StaticBody2D" parent="." unique_id=1153049543]
position = Vector2(-21.5, -80)
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="LeftBoundaryBody" unique_id=595374678]
shape = SubResource("RectangleShape2D_rrkwn")
[node name="RightBoundaryBody" type="StaticBody2D" parent="." unique_id=1425356485]
position = Vector2(4115.5, -80)
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="RightBoundaryBody" unique_id=2009094553]
shape = SubResource("RectangleShape2D_xmv3o")
+59
View File
@@ -0,0 +1,59 @@
[gd_scene load_steps=7 format=3]
[ext_resource type="Script" path="res://scenes/ground/ground_background.gd" id="1_ground_background"]
[ext_resource type="Texture2D" path="res://assets/art/ground/past/past.png" id="2_past"]
[ext_resource type="Texture2D" path="res://assets/art/ground/future/future.png" id="3_future"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ground"]
size = Vector2(2301, 8)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_left_boundary"]
resource_name = "RectangleShape2D_left_boundary"
size = Vector2(32, 1100)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_right_boundary"]
resource_name = "RectangleShape2D_right_boundary"
size = Vector2(32, 1100)
[node name="ground1" type="Node2D"]
script = ExtResource("1_ground_background")
[node name="GroundAnchor" type="Marker2D" parent="."]
position = Vector2(2047, 560)
[node name="ArtLayer" type="Node2D" parent="."]
position = Vector2(896.5, 0)
z_index = -10
[node name="PastBackground" type="Sprite2D" parent="ArtLayer"]
texture_filter = 2
texture = ExtResource("2_past")
centered = false
[node name="FutureBackground" type="Sprite2D" parent="ArtLayer"]
visible = false
texture_filter = 2
texture = ExtResource("3_future")
centered = false
[node name="GroundBody" type="StaticBody2D" parent="."]
position = Vector2(2047, 560)
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="GroundBody"]
position = Vector2(0, 4)
shape = SubResource("RectangleShape2D_ground")
[node name="LeftBoundaryBody" type="StaticBody2D" parent="."]
position = Vector2(880.5, 150)
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="LeftBoundaryBody"]
shape = SubResource("RectangleShape2D_left_boundary")
[node name="RightBoundaryBody" type="StaticBody2D" parent="."]
position = Vector2(3213.5, 150)
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="RightBoundaryBody"]
shape = SubResource("RectangleShape2D_right_boundary")
+66
View File
@@ -0,0 +1,66 @@
extends Node2D
## 2026-07-06 视差定案(策划:远景夕阳要时刻在画面内):背景是"远景天幕",
## 仅以 0.2 倍速随世界滚动(即 80% 跟随相机)——此前 0.92/0.8 的"近景层"
## 参数方向反了,背景几乎钉在世界上,所以一直"看不出视差"。
## 锚点 1734.5 = 让夕阳(原画 x≈760,世界 x≈1656)在出生点镜头(可见中心
## 1340.8)恰好居中;相机全程 [1340.8, 2753.2] 内夕阳屏幕位置从中心缓移到
## 左 282px,始终在画面内(已验算含光晕不出屏)。两端背景覆盖也已验算:
## 极左窗 [880,1801.6]⊂[581.5,2882.5]、极右窗 [2292.4,3214]⊂[1711.5,4012.5]。
## 已知取舍:步道砖烙在原画里会明显随镜头走(角色脚下滑动感),单张烙死图
## 无解;美术把"近景步道"拆成独立 1:1 层后即可消除。勿用 Parallax2D
## (历史上因 CanvasModulate/wipe 兼容性移除过,见 decisions.md)。
const PARALLAX_SCROLL_SCALE := 0.2
const PARALLAX_ANCHOR_X := 1734.5
@onready var past_background: CanvasItem = $ArtLayer/PastBackground
@onready var future_background: CanvasItem = $ArtLayer/FutureBackground
@onready var _art_layer: Node2D = $ArtLayer
var _art_base_x := 0.0
func _ready() -> void:
_art_base_x = _art_layer.position.x
_set_time_phase(_current_time_phase())
var bus := _event_bus_or_null()
if bus != null and bus.has_signal("time_phase_changed") and not bus.is_connected("time_phase_changed", _on_time_phase_changed):
bus.connect("time_phase_changed", _on_time_phase_changed)
func _process(_delta: float) -> void:
var camera := get_viewport().get_camera_2d()
if camera == null:
# headless 测试/无相机场景:背景保持原位。
_art_layer.position.x = _art_base_x
return
# get_screen_center_position 含 limit 夹取,玩家贴墙时背景不会继续滑。
var center_x := camera.get_screen_center_position().x
_art_layer.position.x = _art_base_x + (center_x - PARALLAX_ANCHOR_X) * (1.0 - PARALLAX_SCROLL_SCALE)
func _on_time_phase_changed(_previous: StringName, current: StringName, _reason: StringName) -> void:
_set_time_phase(current)
func _set_time_phase(time_phase: StringName) -> void:
var use_future := time_phase == &"future"
if past_background != null:
past_background.visible = not use_future
if future_background != null:
future_background.visible = use_future
func _current_time_phase() -> StringName:
if not is_inside_tree():
return &"past"
var manager := get_tree().root.get_node_or_null("TimePhaseManager")
if manager != null:
return StringName(str(manager.get("current_time_phase")))
return &"past"
func _event_bus_or_null() -> Node:
if not is_inside_tree():
return null
return get_tree().root.get_node_or_null("EventBus")
+1
View File
@@ -0,0 +1 @@
uid://ba7fyvg1ukb8e