pull/2/head
jaysunxiao 2021-12-12 20:11:21 +08:00
parent ef06a13fb7
commit 43d8d57ae4
3 changed files with 64 additions and 1 deletions

View File

@ -18,10 +18,12 @@ Sprite用来显示一张图片再给Sprite增加一个刚体
3 移除RigidBody2D刚体节点 3 移除RigidBody2D刚体节点
``` ```
# 2. Node2D节点 # 2. Node节点
- Node节点父类节点 - Node节点父类节点
![Image text](image/node2d-01.JPG)
``` ```
1. Pause Mode节点的暂停 1. Pause Mode节点的暂停
get_tree().paused = true get_tree().paused = true
@ -34,14 +36,41 @@ Process处理 :无条件处理节点(以及 Inherit 模式的子节点
process方法执行的优先级对于子节点依然有效 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 - CanvasItem节点CanvasItem -> Node
- Canvas是画布的意思所以CanvasItem代表了就是可以被绘制节点
- CanvasItem是按树的树的深度优先遍历顺序绘制的
- 默认情况下子项在其父项的顶部所以根CanvasItem将被画在所有项的后面
- 可以通过设置CanvasItem的Show Behind Parent来改变最终渲染到屏幕上的画面顺序
``` ```
所有2d节点都要继承的节点设置可视化设置材质的颜色 所有2d节点都要继承的节点设置可视化设置材质的颜色
``` ```
# 4. Node2D节点
- Node2D节点Node2d -> CanvasItem -> Node - Node2D节点Node2d -> CanvasItem -> Node
``` ```

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

View File

@ -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