Godot01-初体验

1-火柴人场景
-
1-游戏坐标:x(向右为正)y(向下为正)
-
2-创建Scene场景(类型:Node2D)
-
3-创建物品(类型:Sprite2D)
-
4-添加物品图盘(拖拽到右侧Texture图标中)
-
5-物品无法直接修改大小(只能修改scale大小)
-
6-尝试进行一个火柴人的拼装(父子节点组合)


2-gdscript初体验
1-gdscript官网文档:https://docs.godotengine.org/zh-cn/4.x/about/introduction.html
2-推荐直接点击doc跳转在线看指定版本
- 1-创建Scene场景(类型:Node2D)
- 2-创建gdscript脚本(gdscript一种针对godot的Script语言)
- 3-创建物品(类型:Sprite2D)
- 4-打印物品位置属性(测试:脚本和物品联动)
- 5-编写一个可视化代码-物品旋转(测试:脚本和物品联动)
- 创建gdscript脚本

gdscript
extends Node2D
# Called when the node enters the scene tree for the first time.
# 当节点首次进入场景树时调用
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
# 每帧调用 'delta' 是距上一帧经过的时间
func _process(delta: float) -> void:
pass
- 编写一个可视化代码-物品旋转
gdscript
extends Node2D
# Called when the node enters the scene tree for the first time.
# 当节点首次进入场景树时调用
func _ready() -> void:
print($IconSprite.position)
# Called every frame. 'delta' is the elapsed time since the previous frame.
# 每帧调用 'delta' 是距上一帧经过的时间
func _process(delta: float) -> void:
$IconSprite.rotation += 20 * delta
print($IconSprite.rotation)