第一人称射击游戏教程

学习如何实现第一人称射击游戏中的机制。

Choose your operating system:

Windows

macOS

Linux

前置主题

为了理解并使用本文中的内容,请确保您已掌握以下主题:

本页面的内容

FPS_CoverImage.PNG

上图是教程完成后的效果。

如你是虚幻引擎(UE4)新手,建议你先阅读

[](programming-and-scripting/programming-language-implementation/programming-with-cpp-in-unreal-engine/unreal-engine-cpp-programming-tutortials/unreal-engine-cpp-quick-start)
,学习 UE4 中的 C++。学习此教程的前提是了解如何创建项目、为项目添加 C++ 代码,以及在虚幻编辑器中配置输入。

如你已可使用 UE4 中的 C++,但不确定如何创建 Pawn 类或配置输入,可通过 玩家输入和Pawn 教程开始学习上手必需的 C++ 概念和技能。

目标

此教程旨在说明如何使用 C++ 构建基本的第一人称射击游戏(FPS)。

目的

完成教程之后你将学会:

  • 设置项目

  • 实现角色

  • 实现发射物

  • 设置角色动画

各个部分

  • [](programming-and-scripting/programming-language-implementation/cpp-in-unreal-engine/unreal-engine-cpp-tutorials/FirstPersonShooter/1 "% programming-and-scripting/programming-language-implementation/cpp-in-unreal-engine/unreal-engine-cpp-tutorials/FirstPersonShooter/1:description%")

  • [](programming-and-scripting/programming-language-implementation/cpp-in-unreal-engine/unreal-engine-cpp-tutorials/FirstPersonShooter/2 "% programming-and-scripting/programming-language-implementation/cpp-in-unreal-engine/unreal-engine-cpp-tutorials/FirstPersonShooter/2:description%")

  • [](programming-and-scripting/programming-language-implementation/cpp-in-unreal-engine/unreal-engine-cpp-tutorials/FirstPersonShooter/3 "% programming-and-scripting/programming-language-implementation/cpp-in-unreal-engine/unreal-engine-cpp-tutorials/FirstPersonShooter/3:description%")

  • [](programming-and-scripting/programming-language-implementation/cpp-in-unreal-engine/unreal-engine-cpp-tutorials/FirstPersonShooter/4 "% programming-and-scripting/programming-language-implementation/cpp-in-unreal-engine/unreal-engine-cpp-tutorials/FirstPersonShooter/4:description%")

本文基于此前的虚幻引擎版本编写,未针对当前的虚幻引擎5.0版本更新过。