C# 2D 游戏编程教程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2330168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:29:19  来源:igfitidea点击:

2D game programming tutorials in C#

c#.net2d

提问by Bloodyaugust

I want to learn about programming 2D games in C#. What are the best tutorials that are beginner oriented, written for C#, and preferably use GDI+ (or something equally simple)? I am relying on the experience this community has to direct me towards the best.

我想学习用 C# 编写 2D 游戏。什么是面向初学者、为 C# 编写并且最好使用 GDI+(或同样简单的东西)的最佳教程?我依靠这个社区的经验来指导我走向最好的方向。

采纳答案by Robert Greiner

Books

图书

Beginning .NET Game Programming

开始 .NET 游戏编程

Beginning C# Game Programming

开始 C# 游戏编程

Links

链接

Coding 4 Funis a great .NET resource that has quite a few user-created games. They also have a bookand a 2-D game primer

Coding 4 Fun是一个很棒的 .NET 资源,它有很多用户创建的游戏。他们还有一本书和一个2-D 游戏入门

Tutorial Listing at C# corner

C# 角的教程列表

C# Game Tutorial for Beginners (video)

C# 初学者游戏教程(视频)

Link to more game programming e-books

链接到更多游戏编程电子书

Advanced Topics

高级主题

The Farseer Physics Engineon Codeplex would be a good next step once you get comfortable with programming games. You could even end up contributing to the project if you like it enough. I'm sure they'd appreciate the help.

一旦您熟悉了编程游戏,Codeplex 上的Farseer 物理引擎将是一个很好的下一步。如果您足够喜欢它,您甚至可以最终为该项目做出贡献。我相信他们会感谢帮助。

回答by Danny Varod

I would start with learn a little object oriented architecture - this is a key to your ultimate success.

我会从学习一点面向对象的架构开始——这是你最终成功的关键。

Then learn how to design the model - the entities in the game (characters and etc) in code and the view - the 2D representation of them, and how to connect the two (data and command binding).

然后学习如何设计模型 - 代码和视图中的游戏中的实体(角色等) - 它们的 2D 表示,以及如何连接两者(数据和命令绑定)。

I would try using WPF and not GDI+.

我会尝试使用 WPF 而不是 GDI+。

The code projecthas a lot of good articles for beginners.

代码项目有很多适合初学者的好文章。

回答by Bobby

I watched these DNR TV episodes recently and thought they were very well done and informative.

我最近看了这些 DNR 电视剧集,认为它们做得很好,内容丰富。

http://www.dnrtv.com/default.aspx?showNum=165
http://www.dnrtv.com/default.aspx?showNum=166

http://www.dnrtv.com/default.aspx?showNum=165
http://www.dnrtv.com/default.aspx?showNum=166

These focus on XNA, which is definitely where I'd start if I was planning on creating a game. Their tutorial take you through:

这些都集中在 XNA 上,如果我计划创建游戏,这绝对是我开始的地方。他们的教程将带您完成:

creating a 2D game with:

创建一个 2D 游戏:

  • collision detection
  • texture creation and usage
  • geometry creation
  • physics simulation (They use an open-source physics engine and show you how to use it)
  • 碰撞检测
  • 纹理创建和使用
  • 几何创建
  • 物理模拟(他们使用开源物理引擎并向您展示如何使用它)

If you haven't heard of XNA:

如果您还没有听说过 XNA:

The framework runs on a version of the Common Language Runtime that is optimized for gaming to provide a managed execution environment. The runtime is available for Windows XP, Windows Vista, Windows 7, and Xbox 360 [also can be played on Zune HDs].

XNA attempts to free game developers from writing "repetitive boilerplate code" and to bring different aspects of game production into a single system. wikipedia

该框架在针对游戏优化的公共语言运行时版本上运行,以提供托管执行环境。该运行时适用于 Windows XP、Windows Vista、Windows 7 和 Xbox 360 [也可以在 Zune HD 上播放]。

XNA 试图将游戏开发者从编写“重复样板代码”中解放出来,并将游戏制作的不同方面整合到一个系统中。维基百科

Even if you don't want to use XNA, I think these videos will help learn about the concepts and techniques common to most (if not all) game dev. Oh, and it's all C#:)

即使您不想使用 XNA,我认为这些视频也将有助于了解大多数(如果不是全部)游戏开发者常见的概念和技术。哦,这都是 C#:)

Good luck!

祝你好运!

回答by zebrabox

This linkseems reasonable ( if a little verbose ) - it's takes you through how to code a simple tetris-like game in c# using GDI+. I has code listings and links to download the source code.

这个链接看起来很合理(如果有点冗长) - 它会带你了解如何使用 GDI+ 在 c# 中编写一个简单的类似俄罗斯方块的游戏。我有代码清单和下载源代码的链接。

回答by Chris Meek

I would take a look at SDL.Netit's a pretty good games library for .NET (well a binding to a good library for the pedants ;))

我会看看SDL.Net,它是一个非常好的 .NET 游戏库(以及一个绑定到一个好的书呆子库;))

It has a lot of resources on its pages right from beginner stuff to more advanced things like isometric engines etc.

它的页面上有很多资源,从初学者到等距引擎等更高级的东西。

It doesn't seem to have been very active for a while however what is there already is more than enough for even complex 2D games.

它似乎已经有一段时间不太活跃了,但是对于复杂的 2D 游戏来说已经足够了。