diff --git a/doc/demo01_hello/5.node2d.md b/doc/demo01_hello/5.node2d.md index c721f96..3ee6990 100644 --- a/doc/demo01_hello/5.node2d.md +++ b/doc/demo01_hello/5.node2d.md @@ -18,10 +18,12 @@ Sprite用来显示一张图片,再给Sprite增加一个刚体 3 移除RigidBody2D刚体节点 ``` -# 2. Node2D节点 +# 2. Node节点 - Node节点,父类节点 +![Image text](image/node2d-01.JPG) + ``` 1. Pause Mode节点的暂停 get_tree().paused = true @@ -34,14 +36,41 @@ Process(处理) :无条件处理节点(以及 Inherit 模式的子节点 process方法执行的优先级,对于子节点依然有效 挂载外部的脚本 + ``` +``` +# Called when the node enters the scene tree for the first time. +func _ready(): + # get_tree().paused = true + pass + +var count = 0 +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + count = count + 1 + + if (count % 60 == 0): + print("parent node") + pass +``` + +# 3. CanvasItem节点 + - CanvasItem节点,CanvasItem -> Node +- Canvas是画布的意思,所以CanvasItem代表了就是可以被绘制节点 + +- CanvasItem是按树的树的深度优先遍历顺序绘制的 +- 默认情况下,子项在其父项的顶部,所以根CanvasItem将被画在所有项的后面 +- 可以通过设置CanvasItem的Show Behind Parent来改变最终渲染到屏幕上的画面顺序 + ``` 所有2d节点都要继承的节点,设置可视化,设置材质的颜色 ``` +# 4. Node2D节点 + - Node2D节点,Node2d -> CanvasItem -> Node ``` diff --git a/doc/demo01_hello/image/node2d-01.JPG b/doc/demo01_hello/image/node2d-01.JPG new file mode 100644 index 0000000..5c6af10 Binary files /dev/null and b/doc/demo01_hello/image/node2d-01.JPG differ diff --git a/doc/demo01_hello/image/node2d-01.JPG.import b/doc/demo01_hello/image/node2d-01.JPG.import new file mode 100644 index 0000000..afab677 --- /dev/null +++ b/doc/demo01_hello/image/node2d-01.JPG.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/node2d-01.JPG-08ad83c39fc41db8695db0d7520e3e64.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://doc/demo01_hello/image/node2d-01.JPG" +dest_files=[ "res://.import/node2d-01.JPG-08ad83c39fc41db8695db0d7520e3e64.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0