2022-01-02 11:22:59 +00:00
|
|
|
# 1. 场景树
|
|
|
|
|
2021-10-03 06:22:00 +00:00
|
|
|
![Image text](image/scene-tree.png)
|
2021-10-03 01:02:45 +00:00
|
|
|
![Image text](image/场景循环.png)
|
2022-01-02 11:22:59 +00:00
|
|
|
|
|
|
|
# 2. 帧率
|
|
|
|
|
|
|
|
- 帧率 Framerate ,指画面每秒更新多少次 (FPS, Frames Per Second)
|
|
|
|
|
|
|
|
```
|
|
|
|
比如,
|
|
|
|
FPS = 50 , 即每 20ms 秒更新一次
|
|
|
|
FPS = 60, 约 16.7ms 秒更新一次
|
|
|
|
|
|
|
|
通过代码可以设置,要求 godot 引擎尽量以此帧率运行 ,但实际帧率还是会有偏差
|
|
|
|
Engine.target_fps = 120
|
|
|
|
```
|
|
|
|
|
2021-10-03 01:02:45 +00:00
|
|
|
![Image text](image/场景帧.png)
|
2022-01-02 11:22:59 +00:00
|
|
|
|
|
|
|
- delta time上一帧的间隔
|
|
|
|
|
|
|
|
```
|
|
|
|
匀速移动的优化:
|
|
|
|
var step = 0.8f * deltaTime;
|
|
|
|
其中,
|
|
|
|
0.8f 表示每秒位移 0.8 单位
|
|
|
|
```
|
|
|
|
|
2021-10-03 01:02:45 +00:00
|
|
|
![Image text](image/delta.png)
|
|
|
|
![Image text](image/delta-1.png)
|
|
|
|
![Image text](image/godot_process.jpg)
|
|
|
|
![Image text](image/godot_node.jpg)
|
|
|
|
![Image text](image/godot_lifecycle.jpg)
|
|
|
|
|
|
|
|
![Image text](image/process.png)
|
|
|
|
![Image text](image/process-1.png)
|
|
|
|
![Image text](image/physics.png)
|
|
|
|
![Image text](image/physics-1.png)
|