save code

This commit is contained in:
xsl
2025-11-24 22:41:37 +08:00
parent f2f7a5a7a2
commit 6a253ae512
12 changed files with 2295 additions and 4 deletions
+27
View File
@@ -0,0 +1,27 @@
using Godot;
using System;
public partial class move : Node3D
{
// 移动速度变量,可以在编辑器中调整
[Export]
public float MoveSpeed = 2.0f;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
// 将double类型的delta转换为float,便于计算
float deltaf = (float)delta;
// 创建Z轴正方向的移动向量
Vector3 movement = -Vector3.Forward * MoveSpeed * deltaf;
// 应用移动
Translate(movement);
}
}