[GodotDL C# D1]从安装环境到角色简单运动

Godot —— Your free, open‑source game engine.

Develop your 2D & 3D games, cross-platform projects, or even XR ideas!

开始前 请确保您有一定的Godot以及C#能力且已安装VSCode与.NET 6+

安装 Godot

官方下载:https://godotengine.org/download/windows/
镜像(我测试有1m/s左右):https://downloads.tuxfamily.org/godotengine/
我使用的是Godot_v4.3-beta1_win64
下载完成后解压打开就行

创建项目

image
点击左上方的创建
image
输入完成后 点击创建并编辑

进入主编辑页面后,添加一个characterbody3d节点
image
再来添加形状,相机......
image

最后为characterbody3d添加脚本,已经内置了简单移动
image

或者添加我这个单向移动的Line.cs
using Godot;
using System;

public partial class Line : CharacterBody3D
{
	public const float Speed = 10f;
	public const float JumpVelocity = 4.5f;
	public override void _PhysicsProcess(double delta)
	{
		Vector3 velocity = Velocity;
		velocity.X = Speed;
		Velocity = velocity;
		MoveAndSlide();
	}
}
效果:

image
https://www.cnblogs.com/meny233/p/18250399

posted @ 2024-06-16 11:43  meny  阅读(4)  评论(0编辑  收藏  举报