@@ -175,8 +175,6 @@ TestCharacter (Node2D)
175175
176176<b >其中` Visuals ` ,` Bounds ` ,` IntentPos ` ,` CenterPos ` 需要右键勾选` 作为唯一名称访问 ` ,出现` % ` 即可。名字不要改。</b >
177177
178- ~~ 创建一个` NTestCharacter.cs ` ,继承` CreatureVisuals ` 。然后把它挂载到` TestCharacter ` 节点上。~~ 现在不需要了。
179-
180178` Bounds ` 就是你的人物hitbox的大小,如果你觉得血条太短调整一下它的大小。
181179
182180* 人物显示在x轴上方。
@@ -186,15 +184,15 @@ TestCharacter (Node2D)
186184
187185### 人物动画
188186
189- * 其中` Visuals ` 可以更改成任意继承了` Node2D ` 的类型,例如` SpineSprite ` ,` Sprite2D ` 或是 ` AnimatedSprite2D ` ,或者在它之下新建节点都可。
187+ * 其中` Visuals ` 可以更改成任意继承了` Node2D ` 的类型,例如` SpineSprite ` ,` Sprite2D ` , ` AnimatedSprite2D ` 或是 ` AnimationPlayer ` ,或者在它之下新建节点都可。
190188
191189* 如果要自然支持Spine播放,需要把` Visuals ` 改成` SpineSprite ` ,且你的战斗人物模型需要有` idle_loop ` (待机循环),` attack ` (攻击动作),` cast ` (能力卡动作),` hurt ` (受伤),` die ` (死亡)这些动画名。(如果你没有` SpineSprite ` ,参考` 卡图&皮肤替换 ` 一章先下载` Spine Godot Extension ` 。)
192190
193191* 如果你只有一张图,那么把` Visuals ` 改成` Sprite2D ` 类型更改图片即可。
194192
195- * 此外 ` baselib ` 支持使用 ` AnimationPlayer ` 控制动画,例如你使用 ` AnimatedSprite2D ` 或者是3D模型。虽然 ` AnimationPlayer ` 放在任意位置都可以,但推荐把根节点之下。动画名和上方设置的一致即可自动播放动画 。
193+ * 如果你使用 ` AnimatedSprite2D ` ,确保动画名和上方一致 。
196194
197- * 例如:如果是使用 ` AnimatedSprite2D ` ,设置好 ` 临近FPS ` (例如0.2秒),然后前往 ` Visuals ` 节点点击属性 ` Frame ` 右侧的钥匙插入关键帧,重复修改当前帧和插入关键帧即可。参考: https://docs.godotengine.org/en/stable/tutorials/2d/2d_sprite_animation.html#sprite-sheet-with-animationplayer
195+ * 此外 ` baselib ` 支持使用 ` AnimationPlayer ` 控制动画。虽然 ` AnimationPlayer ` 放在任意位置都可以,但推荐把根节点之下。动画名和上方设置的一致即可自动播放动画。
198196
199197## 自定义能量表盘
200198
@@ -218,65 +216,7 @@ TestEnergyCounter (Control)
218216
219217![ alt text] ( ../../images/image19.png )
220218
221- 然后创建一个继承` NEnergyCounter ` 的类,挂载到父节点上。
222-
223- ``` csharp
224- public partial class NTestEnergyCounter : NEnergyCounter
225- {
226- }
227- ```
228-
229- 然后创建一个继承` NParticlesContainer ` 的类,挂载到` EnergyVfxBack ` 和` EnergyVfxFront ` 上。
230-
231- 其中的` _particles ` 无法使用` Export ` 设置,所以需要反射设置。当然你也可以往里添加` GpuParticles2D ` 以添加粒子动画效果。具体参考原版。
232-
233- ``` csharp
234- public partial class NTestParticlesContainer : NParticlesContainer
235- {
236- public override void _Ready ()
237- {
238- base ._Ready ();
239- Traverse .Create (this ).Field (" _particles" ).SetValue (new Array <GpuParticles2D >());
240- }
241- }
242- ```
243-
244- 然后创建一个继承` MegaLabel ` 的类,挂载到` Label ` 上。
245-
246- ``` csharp
247- public partial class TestMegaLabel : MegaLabel
248- {
249- }
250- ```
251-
252- 保存一下然后关闭这个场景,然后开始<b >神秘操作</b >。在本地,或者是你的ide里打开这个tscn文件,先修改开头,
253- * 在` ext_resource ` 这一组下添加` kreon_bold_shared_font ` 这一行。
254- * 在` ext_resource ` 这一组下添加` FontVariation_kreon_bold_shared_font ` ,` base_font ` ,` spacing_glyph ` 这三行。
255- * 修改` load_steps ` ,改为原来的数字+2。(ext数量+sub数量+1)
256-
257- ``` tscn
258- [gd_scene load_steps=7 format=3 uid="uid://cs3a5onikvhi4"]
259-
260- [ext_resource type="Texture2D" path="res://icon.svg" id="1_85qf2"]
261- [ext_resource type="Script" path="res://Scripts/NTestEnergyCounter.cs" id="1_tmfxn"]
262- [ext_resource type="Script" path="res://Scripts/NTestParticlesContainer.cs" id="2_1ytbd"]
263- [ext_resource type="Script" path="res://Scripts/TestMegaLabel.cs" id="4_6cpd0"]
264-
265- [ext_resource type="FontVariation" path="res://themes/kreon_bold_shared.tres" id="kreon_bold_shared_font"]
266-
267- [sub_resource type="FontVariation" id="FontVariation_kreon_bold_shared_font"]
268- base_font = ExtResource("kreon_bold_shared_font")
269- spacing_glyph = 2
270- ```
271-
272- * 然后往下,找到` [node name="Label" type="Label" parent="."] ` 这一行,添加以下这一行。
273-
274- ``` tscn
275- theme_override_fonts/font = SubResource("FontVariation_kreon_bold_shared_font")
276- ```
277-
278- * 然后如果你想修改这个能量表盘,打开场景后需要重复以上工作。
279- * 或者你也可以把反编译的字体资源复制到本地以省去以上工作。
219+ 由于` BaseLib ` 做了工作,你的节点现在不需要挂载脚本了。
280220
281221## 本地化文件
282222
@@ -517,13 +457,11 @@ color = Color(0.121879734, 0.15283081, 0.33476263, 1)
517457
518458` test_character.tscn ` :
519459``` tscn
520- [gd_scene load_steps=3 format=3 uid="uid://c4dnpxxd6ldei"]
460+ [gd_scene load_steps=2 format=3 uid="uid://c4dnpxxd6ldei"]
521461
522- [ext_resource type="Script" uid="uid://6m0cydgurd52" path="res://Scripts/NTestCharacter.cs" id="creature_visuals"]
523462[ext_resource type="Texture2D" uid="uid://ddxmxgyyfy8mn" path="res://icon.svg" id="1_hxav6"]
524463
525464[node name="TestCharacter" type="Node2D"]
526- script = ExtResource("creature_visuals")
527465
528466[node name="Visuals" type="Sprite2D" parent="."]
529467unique_name_in_owner = true
@@ -550,30 +488,20 @@ position = Vector2(0, -72)
550488` test_energy_counter.tscn ` :
551489
552490``` tscn
553- [gd_scene load_steps=7 format=3 uid="uid://cs3a5onikvhi4"]
491+ [gd_scene load_steps=2 format=3 uid="uid://cs3a5onikvhi4"]
554492
555493[ext_resource type="Texture2D" uid="uid://ddxmxgyyfy8mn" path="res://icon.svg" id="1_85qf2"]
556- [ext_resource type="Script" uid="uid://b4eaf7kin174o" path="res://Scripts/NTestEnergyCounter.cs" id="1_tmfxn"]
557- [ext_resource type="Script" uid="uid://b8vmh6070x38m" path="res://Scripts/NTestParticlesContainer.cs" id="2_1ytbd"]
558- [ext_resource type="Script" uid="uid://camgj4bhk5dps" path="res://Scripts/TestMegaLabel.cs" id="4_6cpd0"]
559-
560- [ext_resource type="FontVariation" path="res://themes/kreon_bold_shared.tres" id="kreon_bold_shared_font"]
561-
562- [sub_resource type="FontVariation" id="FontVariation_kreon_bold_shared_font"]
563- spacing_glyph = 2
564494
565495[node name="TestEnergyCounter" type="Control"]
566496layout_mode = 3
567497anchors_preset = 0
568498offset_right = 128.0
569499offset_bottom = 128.0
570- script = ExtResource("1_tmfxn")
571500metadata/_edit_lock_ = true
572501
573502[node name="EnergyVfxBack" type="Node2D" parent="."]
574503unique_name_in_owner = true
575504position = Vector2(64, 64)
576- script = ExtResource("2_1ytbd")
577505
578506[node name="Layers" type="Control" parent="."]
579507unique_name_in_owner = true
@@ -603,7 +531,6 @@ expand_mode = 1
603531[node name="EnergyVfxFront" type="Node2D" parent="."]
604532unique_name_in_owner = true
605533position = Vector2(64, 64)
606- script = ExtResource("2_1ytbd")
607534
608535[node name="Label" type="Label" parent="."]
609536layout_mode = 1
@@ -623,10 +550,8 @@ theme_override_constants/shadow_offset_x = 3
623550theme_override_constants/shadow_offset_y = 2
624551theme_override_constants/outline_size = 16
625552theme_override_constants/shadow_outline_size = 16
626- theme_override_fonts/font = SubResource("FontVariation_kreon_bold_shared_font")
627553theme_override_font_sizes/font_size = 36
628554text = "3/3"
629555horizontal_alignment = 1
630556vertical_alignment = 1
631- script = ExtResource("4_6cpd0")
632557```
0 commit comments