增加资源部署的相关配置文件;调整main演示效果

This commit is contained in:
cakipaul 2024-12-23 21:04:36 +08:00
parent e5422fa107
commit 6afa058aa8
22 changed files with 298 additions and 196 deletions

View File

@ -1,3 +1,3 @@
# xiandie
《衔蝶》开发代码
《衔蝶》开发代码

View File

@ -32,9 +32,9 @@ var displayer = preload("res://config/animation/frames_display_card.tscn")
func _ready() -> void:
var window = get_viewport() as Window
if window:
window.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_FRACTIONAL
# var window = get_viewport() as Window
# if window:
# window.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_FRACTIONAL
# window.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_FRACTIONAL
# window.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_EXPAND
# window.get_visible_rect().size *= 2

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
class_name CgConfig extends Resource
@export var cg_name: String
@export var cg_script: Script

View File

@ -0,0 +1,12 @@
class_name DeploymentConfig extends Resource
class DeploymentItemConfig:
extends Resource
var entity_name: String = ""
var position: Vector2 = Vector2(0, 0)
var initial_state := ""
@export var scene_name: String = ""
@export var items: Array[DeploymentItemConfig]

View File

@ -0,0 +1,10 @@
class_name DialogConfig extends Resource
@export var dialog_name: String
# font style and effect are defined according to the character
@export var dialog_character_name: String
@export var effect := ""
@export var dialog_character_animation: String # empty string means no animation
@export var dialog_content: String
@export var dialog_audio: String
@export var dialog_skipable := true

View File

@ -0,0 +1,30 @@
class_name EntityConfig extends Resource
class EntityStateConfig:
extends Resource
var state_name: String = ""
var animation: String = ""
var loop: bool = false
var sound: String = ""
var state_title: String = "" # use default if empty
var state_note: String = "" # use default if empty
var actions: Array[String] = []
class EntityActionConfig:
extends Resource
var action_name: String = ""
var next_state: String = "" # empty means keep current state
var animation: String = ""
var sound: String = ""
var callback: String = ""
var callback_args := []
@export var entity_name: String = ""
@export var placeholder_rect: Rect2 = Rect2(0, 0, 0, 0)
@export var entity_title: String = ""
@export var entity_note: String = ""
@export var entity_states: Array[EntityStateConfig]
@export var entity_actions: Array[EntityActionConfig]

View File

@ -0,0 +1,11 @@
class_name SceneConfig extends Resource
@export var scene_name: String = ""
@export var camera_range: Rect2 = Rect2(0, -1000, 664, 1317) # 564*317, 16:9
@export var foreground_scale: Vector2 = Vector2(1.2, 1.2)
@export var foreground_position: Vector2 = Vector2(0, 0)
@export var background_scale: Vector2 = Vector2(1.0, 1.0)
@export var background_position: Vector2 = Vector2(0, 0)
@export var player_initial_position: Vector2 = Vector2(300, 186)
@export var player_initial_direction: Vector2 = Vector2(1, -1)
@export var player_movement_rect: Rect2 = Rect2(0, 0, 0, 0)

View File

@ -1 +0,0 @@
class_name AssetMetadata extends Resource

View File

@ -1,11 +0,0 @@
class_name AssetMetadata extends Resource
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -1,6 +1,6 @@
extends Marker2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func tweak_position(velocity, facing_direction):
position.x = facing_direction.x * abs(velocity.x) * 0.3
position.y = facing_direction.y * abs(velocity.y) * 0.3

View File

@ -2,8 +2,3 @@ extends Camera2D
class_name MainCamera
func _ready() -> void:
enabled = true
#position_smoothing_enabled = false
position_smoothing_speed = 10
position_smoothing_enabled = true

View File

@ -9,6 +9,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("1_50vde")
[node name="ColorRectTop" type="ColorRect" parent="."]
@ -22,6 +23,7 @@ offset_left = -282.0
offset_right = 282.0
offset_bottom = 40.0
grow_horizontal = 2
mouse_filter = 2
color = Color(0.372549, 0.0156863, 0.0156863, 1)
[node name="ColorRectBottom" type="ColorRect" parent="."]
@ -38,4 +40,5 @@ offset_top = -38.5
offset_right = 282.0
grow_horizontal = 2
grow_vertical = 0
mouse_filter = 2
color = Color(0.372549, 0.0156863, 0.0156863, 1)

View File

@ -1,12 +1,8 @@
extends ParallaxBackground
#
## Called every frame. 'delta' is the elapsed time since the previous frame.
#func _physics_process(delta: float) -> void:
#var x = Input.get_axis("left", "right")
#var y = Input.get_axis("up", "down")
#camera.position.x += delta * x * 1000
#camera.position.y += delta * y * 1000
@onready var deploy_layer = %DeployLayer as Node2D
func _ready() -> void:
layer = GlobalConfig.CANVAS_LAYER_BG

View File

@ -1,15 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://d0mnndg67dru1"]
[ext_resource type="Script" path="res://scene/ground/parallax_background.gd" id="1_w8735"]
[ext_resource type="Texture2D" uid="uid://dukm6cix2kghn" path="res://asset/art/第一章/场景五1012外间现实版/1012外间.png" id="2_6t5qy"]
[ext_resource type="Texture2D" uid="uid://cjyk6lbbdxiwf" path="res://asset/art/第一章/场景六(院子回忆版)/院子1楼(黄昏有人).png" id="2_fnngl"]
[node name="ParallaxBackground" type="ParallaxBackground"]
scroll_base_offset = Vector2(-250, -200)
script = ExtResource("1_w8735")
[node name="ParallaxLayer" type="ParallaxLayer" parent="."]
[node name="Sprite2D" type="Sprite2D" parent="ParallaxLayer"]
scale = Vector2(1.33649, 1.32083)
texture = ExtResource("2_6t5qy")
texture = ExtResource("2_fnngl")
centered = false
[node name="DeployLayer" type="Node2D" parent="ParallaxLayer"]
unique_name_in_owner = true

View File

@ -1,21 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://02lmmldikfar"]
[ext_resource type="Script" path="res://scene/ground/parallax_foreground.gd" id="1_32n5c"]
[ext_resource type="Texture2D" uid="uid://c0l7pkwvbrgey" path="res://asset/art/第一章/场景五1012外间现实版/前景.png" id="3_4g2yq"]
[ext_resource type="Texture2D" uid="uid://by8h2yuqve7fw" path="res://asset/art/第一章/场景六(院子回忆版)/前景有人版.png" id="2_takn1"]
[ext_resource type="PackedScene" uid="uid://o4a2eluydtep" path="res://scene/ground/boarder_frame.tscn" id="4_18dtv"]
[node name="ParallaxForeground" type="ParallaxBackground"]
scroll_base_offset = Vector2(-250, -200)
script = ExtResource("1_32n5c")
[node name="ParallaxLayer2" type="ParallaxLayer" parent="."]
motion_scale = Vector2(1.1, 1.1)
motion_mirroring = Vector2(2000, 1300)
[node name="Sprite2D" type="Sprite2D" parent="ParallaxLayer2"]
position = Vector2(2, 73)
scale = Vector2(1.33886, 1.05)
texture = ExtResource("3_4g2yq")
position = Vector2(-4, 23)
scale = Vector2(1.2, 1.2)
texture = ExtResource("2_takn1")
centered = false
[node name="ShadedFrame" parent="." instance=ExtResource("4_18dtv")]

View File

@ -7,7 +7,7 @@
[ext_resource type="PackedScene" uid="uid://dc778gsjfr3ky" path="res://scene/hud/prop_hud.tscn" id="4_t7gb2"]
[ext_resource type="PackedScene" uid="uid://5g07x6q7wwr1" path="res://scene/notification/notification.tscn" id="5_3gg5t"]
[ext_resource type="PackedScene" uid="uid://cekhj65axie0p" path="res://scene/popup/prop_inspector_2d.tscn" id="5_ux0rw"]
[ext_resource type="PackedScene" uid="uid://cjhw5ecygrqty" path="res://scene/player/player_2d.tscn" id="6_6geb0"]
[ext_resource type="PackedScene" uid="uid://cjhw5ecygrqty" path="res://scene/player/main_player.tscn" id="6_6geb0"]
[ext_resource type="PackedScene" uid="uid://cqkeegrcdjyg4" path="res://scene/camera/camera_focus_marker.tscn" id="7_n7qcv"]
[ext_resource type="PackedScene" uid="uid://ogyvstscr0kx" path="res://scene/camera/main_camera.tscn" id="8_nj084"]
[ext_resource type="PackedScene" uid="uid://02lmmldikfar" path="res://scene/ground/parallax_foreground.tscn" id="11_anxqu"]
@ -29,20 +29,34 @@ offset_top = -134.0
mouse_filter = 2
[node name="Notification" parent="UILayer" instance=ExtResource("5_3gg5t")]
mouse_filter = 2
[node name="VignetteShading" parent="." instance=ExtResource("2_d1re1")]
[node name="PropInspector2D" parent="." instance=ExtResource("5_ux0rw")]
[node name="Player2D" parent="." instance=ExtResource("6_6geb0")]
[node name="MainPlayer" parent="." instance=ExtResource("6_6geb0")]
unique_name_in_owner = true
position = Vector2(300, 187)
current_status = 0
facing_direction = Vector2(1, -1)
running_locked = false
speed_walking = 100.0
speed_runnig = 170.0
speed_laying = 60.0
speed_climbing = 60.0
[node name="CameraFocusMarker" parent="MainPlayer" instance=ExtResource("7_n7qcv")]
unique_name_in_owner = true
[node name="CameraFocusMarker" parent="Player2D" instance=ExtResource("7_n7qcv")]
unique_name_in_owner = true
[node name="MainCamera" parent="Player2D/CameraFocusMarker" instance=ExtResource("8_nj084")]
[node name="MainCamera" parent="MainPlayer/CameraFocusMarker" instance=ExtResource("8_nj084")]
unique_name_in_owner = true
position = Vector2(1, 0)
limit_left = 0
limit_top = -1000
limit_right = 1500
limit_bottom = 1317
limit_smoothed = true
position_smoothing_enabled = true
position_smoothing_speed = 8.0
[node name="ParallaxForeground" parent="." instance=ExtResource("11_anxqu")]

View File

@ -9,4 +9,29 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 0
mouse_filter = 2
script = ExtResource("1_j0g80")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -208.0
offset_bottom = 40.0
grow_horizontal = 0
mouse_filter = 2
theme_override_constants/margin_top = 12
theme_override_constants/margin_right = 24
[node name="RichTextLabel" type="RichTextLabel" parent="MarginContainer"]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 8
mouse_filter = 2
text = "notification"
fit_content = true
scroll_active = false
autowrap_mode = 0
text_direction = 2

View File

@ -33,10 +33,10 @@ enum MOVEMENT_STATUS {
if is_climbing:
is_laying = false
@export var running_locked := false
@export var speed_walking := 300.0
@export var speed_runnig := 500.0
@export var speed_laying := 150.0
@export var speed_climbing := 170.0
@export var speed_walking := 100.0
@export var speed_runnig := 170.0
@export var speed_laying := 60.0
@export var speed_climbing := 60.0
#const JUMP_VELOCITY = -400.0
@onready var camera = %MainCamera as Camera2D
@ -162,5 +162,4 @@ func _physics_process(_delta: float) -> void:
func _tweak_camera_marker():
var marker = get_node("./CameraFocusMarker") as Node2D
if marker:
marker.position.x = facing_direction.x * abs(velocity.x) * 0.11
marker.position.y = facing_direction.y * abs(velocity.y) * 0.11
marker.tweak_position(velocity, facing_direction)

View File

@ -1,21 +1,14 @@
[gd_scene load_steps=5 format=3 uid="uid://cjhw5ecygrqty"]
[ext_resource type="Script" path="res://scene/player/player_2d.gd" id="1_3a78y"]
[ext_resource type="SpriteFrames" uid="uid://c43gyexokirl4" path="res://config/animation/player_sprite_frames.tres" id="1_23i43"]
[ext_resource type="Script" path="res://scene/player/main_player.gd" id="1_3a78y"]
[ext_resource type="SpriteFrames" uid="uid://cs44glabs8sma" path="res://config/animation/player_sprite_frames.tres" id="1_23i43"]
[ext_resource type="Texture2D" uid="uid://t526pexw4ng4" path="res://asset/art/neutral_point_light.webp" id="3_scilj"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fno82"]
size = Vector2(105, 238.5)
[node name="Player2D" type="CharacterBody2D"]
[node name="MainPlayer" type="CharacterBody2D"]
script = ExtResource("1_3a78y")
current_status = null
facing_direction = null
running_locked = null
speed_walking = null
speed_runnig = null
speed_laying = null
speed_climbing = null
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
unique_name_in_owner = true