@@ -167,8 +167,6 @@ TestCharacter (Node2D)
167167
168168<b >其中` Visuals ` ,` Bounds ` ,` IntentPos ` ,` CenterPos ` 需要右键勾选` 作为唯一名称访问 ` ,出现` % ` 即可。名字不要改。</b >
169169
170- ~~ 创建一个` NTestCharacter.cs ` ,继承` CreatureVisuals ` 。然后把它挂载到` TestCharacter ` 节点上。~~ 现在不需要了。
171-
172170` Bounds ` 就是你的人物hitbox的大小,如果你觉得血条太短调整一下它的大小。
173171
174172* 人物显示在x轴上方。
@@ -178,15 +176,15 @@ TestCharacter (Node2D)
178176
179177### 人物动画
180178
181- * 其中` Visuals ` 可以更改成任意继承了` Node2D ` 的类型,例如` SpineSprite ` ,` Sprite2D ` 或是 ` AnimatedSprite2D ` ,或者在它之下新建节点都可。
179+ * 其中` Visuals ` 可以更改成任意继承了` Node2D ` 的类型,例如` SpineSprite ` ,` Sprite2D ` , ` AnimatedSprite2D ` 或是 ` AnimationPlayer ` ,或者在它之下新建节点都可。
182180
183181* 如果要自然支持Spine播放,需要把` Visuals ` 改成` SpineSprite ` ,且你的战斗人物模型需要有` idle_loop ` (待机循环),` attack ` (攻击动作),` cast ` (能力卡动作),` hurt ` (受伤),` die ` (死亡)这些动画名。(如果你没有` SpineSprite ` ,参考` 卡图&皮肤替换 ` 一章先下载` Spine Godot Extension ` 。)
184182
185183* 如果你只有一张图,那么把` Visuals ` 改成` Sprite2D ` 类型更改图片即可。
186184
187- * 此外 ` baselib ` 支持使用 ` AnimationPlayer ` 控制动画,例如你使用 ` AnimatedSprite2D ` 或者是3D模型。虽然 ` AnimationPlayer ` 放在任意位置都可以,但推荐把根节点之下。动画名和上方设置的一致即可自动播放动画 。
185+ * 如果你使用 ` AnimatedSprite2D ` ,确保动画名和上方一致 。
188186
189- * 例如:如果是使用 ` AnimatedSprite2D ` ,设置好 ` 临近FPS ` (例如0.2秒),然后前往 ` Visuals ` 节点点击属性 ` Frame ` 右侧的钥匙插入关键帧,重复修改当前帧和插入关键帧即可。参考: https://docs.godotengine.org/en/stable/tutorials/2d/2d_sprite_animation.html#sprite-sheet-with-animationplayer
187+ * 此外 ` baselib ` 支持使用 ` AnimationPlayer ` 控制动画。虽然 ` AnimationPlayer ` 放在任意位置都可以,但推荐把根节点之下。动画名和上方设置的一致即可自动播放动画。
190188
191189## 自定义能量表盘
192190
@@ -210,65 +208,7 @@ TestEnergyCounter (Control)
210208
211209![ alt text] ( ../../images/image19.png )
212210
213- 然后创建一个继承` NEnergyCounter ` 的类,挂载到父节点上。
214-
215- ``` csharp
216- public partial class NTestEnergyCounter : NEnergyCounter
217- {
218- }
219- ```
220-
221- 然后创建一个继承` NParticlesContainer ` 的类,挂载到` EnergyVfxBack ` 和` EnergyVfxFront ` 上。
222-
223- 其中的` _particles ` 无法使用` Export ` 设置,所以需要反射设置。当然你也可以往里添加` GpuParticles2D ` 以添加粒子动画效果。具体参考原版。
224-
225- ``` csharp
226- public partial class NTestParticlesContainer : NParticlesContainer
227- {
228- public override void _Ready ()
229- {
230- base ._Ready ();
231- Traverse .Create (this ).Field (" _particles" ).SetValue (new Array <GpuParticles2D >());
232- }
233- }
234- ```
235-
236- 然后创建一个继承` MegaLabel ` 的类,挂载到` Label ` 上。
237-
238- ``` csharp
239- public partial class TestMegaLabel : MegaLabel
240- {
241- }
242- ```
243-
244- 保存一下然后关闭这个场景,然后开始<b >神秘操作</b >。在本地,或者是你的ide里打开这个tscn文件,先修改开头,
245- * 在` ext_resource ` 这一组下添加` kreon_bold_shared_font ` 这一行。
246- * 在` ext_resource ` 这一组下添加` FontVariation_kreon_bold_shared_font ` ,` base_font ` ,` spacing_glyph ` 这三行。
247- * 修改` load_steps ` ,改为原来的数字+2。(ext数量+sub数量+1)
248-
249- ``` tscn
250- [gd_scene load_steps=7 format=3 uid="uid://cs3a5onikvhi4"]
251-
252- [ext_resource type="Texture2D" path="res://icon.svg" id="1_85qf2"]
253- [ext_resource type="Script" path="res://Scripts/NTestEnergyCounter.cs" id="1_tmfxn"]
254- [ext_resource type="Script" path="res://Scripts/NTestParticlesContainer.cs" id="2_1ytbd"]
255- [ext_resource type="Script" path="res://Scripts/TestMegaLabel.cs" id="4_6cpd0"]
256-
257- [ext_resource type="FontVariation" path="res://themes/kreon_bold_shared.tres" id="kreon_bold_shared_font"]
258-
259- [sub_resource type="FontVariation" id="FontVariation_kreon_bold_shared_font"]
260- base_font = ExtResource("kreon_bold_shared_font")
261- spacing_glyph = 2
262- ```
263-
264- * 然后往下,找到` [node name="Label" type="Label" parent="."] ` 这一行,添加以下这一行。
265-
266- ``` tscn
267- theme_override_fonts/font = SubResource("FontVariation_kreon_bold_shared_font")
268- ```
269-
270- * 然后如果你想修改这个能量表盘,打开场景后需要重复以上工作。
271- * 或者你也可以把反编译的字体资源复制到本地以省去以上工作。
211+ 由于` BaseLib ` 做了工作,你的节点现在不需要挂载脚本了。
272212
273213## 本地化文件
274214
@@ -509,13 +449,11 @@ color = Color(0.121879734, 0.15283081, 0.33476263, 1)
509449
510450` test_character.tscn ` :
511451``` tscn
512- [gd_scene load_steps=3 format=3 uid="uid://c4dnpxxd6ldei"]
452+ [gd_scene load_steps=2 format=3 uid="uid://c4dnpxxd6ldei"]
513453
514- [ext_resource type="Script" uid="uid://6m0cydgurd52" path="res://Scripts/NTestCharacter.cs" id="creature_visuals"]
515454[ext_resource type="Texture2D" uid="uid://ddxmxgyyfy8mn" path="res://icon.svg" id="1_hxav6"]
516455
517456[node name="TestCharacter" type="Node2D"]
518- script = ExtResource("creature_visuals")
519457
520458[node name="Visuals" type="Sprite2D" parent="."]
521459unique_name_in_owner = true
@@ -542,30 +480,20 @@ position = Vector2(0, -72)
542480` test_energy_counter.tscn ` :
543481
544482``` tscn
545- [gd_scene load_steps=7 format=3 uid="uid://cs3a5onikvhi4"]
483+ [gd_scene load_steps=2 format=3 uid="uid://cs3a5onikvhi4"]
546484
547485[ext_resource type="Texture2D" uid="uid://ddxmxgyyfy8mn" path="res://icon.svg" id="1_85qf2"]
548- [ext_resource type="Script" uid="uid://b4eaf7kin174o" path="res://Scripts/NTestEnergyCounter.cs" id="1_tmfxn"]
549- [ext_resource type="Script" uid="uid://b8vmh6070x38m" path="res://Scripts/NTestParticlesContainer.cs" id="2_1ytbd"]
550- [ext_resource type="Script" uid="uid://camgj4bhk5dps" path="res://Scripts/TestMegaLabel.cs" id="4_6cpd0"]
551-
552- [ext_resource type="FontVariation" path="res://themes/kreon_bold_shared.tres" id="kreon_bold_shared_font"]
553-
554- [sub_resource type="FontVariation" id="FontVariation_kreon_bold_shared_font"]
555- spacing_glyph = 2
556486
557487[node name="TestEnergyCounter" type="Control"]
558488layout_mode = 3
559489anchors_preset = 0
560490offset_right = 128.0
561491offset_bottom = 128.0
562- script = ExtResource("1_tmfxn")
563492metadata/_edit_lock_ = true
564493
565494[node name="EnergyVfxBack" type="Node2D" parent="."]
566495unique_name_in_owner = true
567496position = Vector2(64, 64)
568- script = ExtResource("2_1ytbd")
569497
570498[node name="Layers" type="Control" parent="."]
571499unique_name_in_owner = true
@@ -595,7 +523,6 @@ expand_mode = 1
595523[node name="EnergyVfxFront" type="Node2D" parent="."]
596524unique_name_in_owner = true
597525position = Vector2(64, 64)
598- script = ExtResource("2_1ytbd")
599526
600527[node name="Label" type="Label" parent="."]
601528layout_mode = 1
@@ -615,10 +542,8 @@ theme_override_constants/shadow_offset_x = 3
615542theme_override_constants/shadow_offset_y = 2
616543theme_override_constants/outline_size = 16
617544theme_override_constants/shadow_outline_size = 16
618- theme_override_fonts/font = SubResource("FontVariation_kreon_bold_shared_font")
619545theme_override_font_sizes/font_size = 36
620546text = "3/3"
621547horizontal_alignment = 1
622548vertical_alignment = 1
623- script = ExtResource("4_6cpd0")
624549```
0 commit comments