godot-start/script/demo02_base/base4.gd

29 lines
414 B
GDScript
Raw Normal View History

2022-01-10 09:55:22 +00:00
extends Node2D
func _ready():
# new一个Sprite节点
var sprite = Sprite.new()
# 设置图片
var icon = preload("res://icon.png")
sprite.set_texture(icon)
# 修改名称
sprite.name = "mynode"
# 修改坐标居中
sprite.position.x = 200
sprite.position.y = 200
# 添加到当前的场景中
add_child(sprite)
2022-01-13 12:57:33 +00:00
pass
2022-01-10 09:55:22 +00:00
func _process(delta):
var sprite = $mynode
sprite.rotate(0.1)
pass